umbraco 7.4.1 and azure blob storage

DISCLAIMER: BEFORE YOU MAKE ANY CHANGES TO cmsPropertyData TABLE IN THE DATABASE. DO A BACK UP. I HOLD NO RESPONSIBILITY FOR A FAILED UPDATE.

Azure Blob storage Module

https://our.umbraco.org/projects/backoffice-extensions/azure-blob-storage-provider

As part of the 7.4.1 upgrade, Umbraco have changed the way in which images are stored in the database. In previous version of the Core, images were served as absolute URLs to the media item, however, these are now stored as a JSON object.

Stored without image focus points

{"src": "http://www.mywebsite.com/myimage.jpg", crops: []}

Stored with image focus points

{
  "focalPoint": {
    "left": 0.5,
    "top": 0.5
  },
  "src": "http://www.mywebsite.com/myimage.jpg"
}

After upgrading there maybe instances where your local image library has lost the image thumbnails when trying to attach an image using the media picker. This is due to the upgrade process not modifying the old data to the new column. In the cmsPropertyData table, DataNvarchar was still populated with a physical URL to the image an

If the image wasn’t in the correct URL format, it would fall back to using http://www.yoursite.com/umbraco/backoffice/UmbracoApi/Images/GetBigThumbnail?originalImagePath=http://www.mywebsite.com/myimage.jpg

As the image isn’t local to the project, the url could not be used to generate a thumbnail.

Settings > Media Types > Image > Upload Image > change type to Image Cropper

Running the SQL below, should format the urls into the required format to be able to view the images.

UPDATE cmsPropertyData 
SET cmsPropertyData.dataNtext = Formatted.dataNtextCol
FROM (
	SELECT TOP(1000) cmsPropertyData.id,cmsPropertyData.propertytypeid, cmsPropertyData.contentNodeId, '{"src": "' + cmsPropertyData.dataNvarchar  + '", crops: []}' as dataNtextCol
	FROM cmsPropertyData
	WHERE (cmsPropertyData.propertytypeid = 135 AND cmsPropertyData.dataNvarchar is not null AND cmsPropertyData.dataNvarchar  '' AND dataNtext is null) 
	   OR (cmsPropertyData.propertytypeid = 6 AND cmsPropertyData.dataNvarchar is not null AND cmsPropertyData.dataNvarchar  '' and dataNtext is null)
	   ORDER BY cmsPropertyData.contentNodeId
) as Formatted
WHERE cmsPropertyData.id = Formatted.id


UPDATE cmsPropertyData 
SET cmsPropertyData.dataNvarchar = NULL
FROM (
	SELECT TOP(1000) cmsPropertyData.id, cmsPropertyData.propertytypeid, cmsPropertyData.contentNodeId, '{"src": "' + cmsPropertyData.dataNvarchar  + '", crops: []}' as dataNtextCol
	FROM cmsPropertyData
	WHERE (cmsPropertyData.propertytypeid = 135 AND cmsPropertyData.dataNvarchar is not null AND cmsPropertyData.dataNvarchar  '' AND dataNtext is not null) 
	   OR (cmsPropertyData.propertytypeid = 6 AND cmsPropertyData.dataNvarchar is not null AND cmsPropertyData.dataNvarchar  '' and dataNtext is not null)
	    ORDER BY cmsPropertyData.contentNodeId
) as Formatted
WHERE cmsPropertyData.id = Formatted.id
Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s