I have inherited a site which uses DAMP for images. I have successfully upgraded to Umbraco 7 but those image fieds are still DAMP and return DAMP objects. The library to get the objects out no longer works. If I change the field type will the images remain, or is there a way I could just get the images out of the CMS for now to display?
I've upgraded a few Umbraco sites in the past that have used DAMP.
You can change the property in Umbraco to be a Media Picker data type,
(you'd then look to handle crops with the built in image cropper - migrating crops is a different story)
but the problem is migrating the picked images that have their data and crop information stored in the DAMP XML format and not the ID of the Media Item that the Media picker would use.
The XML data is stored in the dataNtext column of the cmsPropertyData table.
The Media Picker would store the pickedId in the dataInt column.
Running the following SQL against the database extracts the picked ID from within the XML, and puts it into the correct dataInt column for the Media picker:
Update cmsPropertyData
set dataInt = CAST(dataNtext AS XML).value('(//Image/@id)[1]', 'int')
where propertytypeid in (60,61,74) and dataNtext like '%<DAMP%'
Where propertytypeid is the id of the property type that you are converting, in the example above I have three DAMP properties with Id 60,61 and 74.
You are not actually deleting the DAMP xml from the dataNtext column, if it all goes wrong :-).
For anyone else, the code above gets one value. But I tweaked the SQL a bit, so this should work for multiple values:
Update cmsPropertyData
set dataNVarchar = REPLACE( CAST(dataNtext AS XML).query('data(//Image/@id)').value('.','nvarchar(80)'), ' ', ',')
where dataNtext like '%<DAMP%'
DAMP in Umbraco 7
Hi,
I have inherited a site which uses DAMP for images. I have successfully upgraded to Umbraco 7 but those image fieds are still DAMP and return DAMP objects. The library to get the objects out no longer works. If I change the field type will the images remain, or is there a way I could just get the images out of the CMS for now to display?
Any help/advice would be appreciated.
Thanks in advance.
Hi Francis
I've upgraded a few Umbraco sites in the past that have used DAMP.
You can change the property in Umbraco to be a Media Picker data type,
(you'd then look to handle crops with the built in image cropper - migrating crops is a different story)
but the problem is migrating the picked images that have their data and crop information stored in the DAMP XML format and not the ID of the Media Item that the Media picker would use.
The XML data is stored in the dataNtext column of the cmsPropertyData table.
The Media Picker would store the pickedId in the dataInt column.
Running the following SQL against the database extracts the picked ID from within the XML, and puts it into the correct dataInt column for the Media picker:
Where propertytypeid is the id of the property type that you are converting, in the example above I have three DAMP properties with Id 60,61 and 74.
You are not actually deleting the DAMP xml from the dataNtext column, if it all goes wrong :-).
regards
Marc
Amazing. Thank you very much. I'll have a try and let you know how it goes.
For anyone else, the code above gets one value. But I tweaked the SQL a bit, so this should work for multiple values:
Thanks Marc :).
Awesome Francis
I only ever had a single media item picked via DAMP!
is working on a reply...