In the following example, we show the recomended way to migrate image properties. The first image property named "List Picture" is the original image set from Image Vault. We then create a duplicate property that will hold the new image that will be referenced by Optimizely DAM named "Migrated List Picture".
We also need to add an attribute on the original image called "ImageVaultMigrationTo" that points to our new migrated property. The migration tool looks for this attribute to know which properties you wish to migrate. Without this attribute, the migration tool will skip this property.
Image Property Example
[ImageVaultMigrationTo(nameof(CmpListPicture))]
[CultureSpecific]
[Display(
Name = "List Picture",
ShortName = "List pic",
Description = "List picture that will be used when list this items in a list.",
GroupName = EditTabs.DisplayContent,
Order = 170)]
[UIHint("ivpropertymedia")]
public virtual MediaReference ListPicture { get; set; }
[Display(
Name = "Migrated List Picture",
ShortName = "Migrated List pic",
Description = "Migrated List picture that will be used when list this items in a list.",
GroupName = EditTabs.DisplayContent,
Order = 174)]
[UIHint("Image")]
public virtual ContentReference CmpListPicture { get; set; }
Following the same pattern as above, we can also apply this to XHTML properties containing assets.
XHTML Property Example (TinyMCE)
[ImageVaultMigrationTo(nameof(CmpContent))]
[CultureSpecific]
[Display(
Name = "Content",
Description = "",
GroupName = SystemTabNames.Content,
Order = 300)]
public virtual XhtmlString Content { get; set; }
[CultureSpecific]
[Display(
Name = "Migrated Content",
Description = "",
GroupName = SystemTabNames.Content,
Order = 301)]
public virtual XhtmlString CmpContent { get; set; }
There are a few reason for this recommended pattern.
- Migrating the image and set the new asset reference without losing the original asset reference.
- Create custom code logic that tries to load the new image, if it fails we fall back to the original image.
- After we have finalized the migrations intergrity we remove the old properties leaving the new ones intact with the new references.
Note: If you are using Optmizely inline blocks that contain assets you wish to migrate, you need to migrate the entire content area containing these inline blocks.