ImageDescriptor blobs not clearing when replacement image is uploaded.

  • Updated

When using ImageDescriptors blobs for Media, you may have an issue where only the default Thumbnail image is being regenerated when you upload a replacement image and not additional ImageDescriptors.  If you have others setup, they are not updated and instead you have to manually clear out the ImageDescriptor fields first and then publish the item. For example:

[ImageDescriptor(Width = 150, Height = 150)]
public virtual Blob MediumThumbnail { get; set; }

[ImageDescriptor(Width = 200, Height = 200)]
public virtual Blob LargeThumbnail { get; set; }

The MediumThumbnail  and LargeThumbnail thumbnails will not be regenerated automatically for the replacement image.  

The recommended way to handle this is to listen for the publishing event hook and have it reset the Image Descriptor attributes.  This way it will automatically clear the fields and allow the blob and ImageDescriptor field to be recreated automatically. The following article will help set this up in your code: