Media Service Save method not updating with new Image Cropper sizes
Using Umbraco.ImageCropper in version 7.2.2, I have added several new crop sizes. In order for the images in my media folders to update and reflect the new crop sizes, they need to be re-saved. Instead of manually saving potentially hundreds of images, I have programmatically used Media Service to do this. Problem is, it doesn't seem to be resetting the crops on the pictures.
Here I set the Media Service and Umbraco Helper:
var ms = ApplicationContext.Current.Services.MediaService;
UmbracoHelper umbracoHelper = new UmbracoHelper(UmbracoContext.Current);
After several foreach loops, I get the IPublishedContent version of the media node, check that it's a visible image on the slideshow, and then save it. I added the Debug.WriteLine to verify the code is being hit. I can see in the Output window that all the images have been saved, supposedly.
I am having an issue that may be related to yours.
I am changing the umbracoFile property for media items in code. You are doing the same, since that's the property that changes when you update the crops.
The changes are saved to the database but the front-end indexes are not updated. On checking closer, it seems that the umbracoCacheInstruction table is not being updated to indicate a change to the media item and therefore the front end indexes do not get updated.
I was thinking it's because changes to that property do not trigger a cache update, but it also doesn't update when I change other properties in the same operation.
Media Service Save method not updating with new Image Cropper sizes
Using Umbraco.ImageCropper in version 7.2.2, I have added several new crop sizes. In order for the images in my media folders to update and reflect the new crop sizes, they need to be re-saved. Instead of manually saving potentially hundreds of images, I have programmatically used Media Service to do this. Problem is, it doesn't seem to be resetting the crops on the pictures.
Here I set the Media Service and Umbraco Helper:
After several foreach loops, I get the IPublishedContent version of the media node, check that it's a visible image on the slideshow, and then save it. I added the Debug.WriteLine to verify the code is being hit. I can see in the Output window that all the images have been saved, supposedly.
I can see the Id's of the Media nodes that were saved, but when I try to retrieve the new crop sizes:
they come back null until I manually save them in the CMS.
I am not able to F11 into the Save method to see what is happening, any help is appreciated.
Thanks
I am having an issue that may be related to yours.
I am changing the umbracoFile property for media items in code. You are doing the same, since that's the property that changes when you update the crops.
The changes are saved to the database but the front-end indexes are not updated. On checking closer, it seems that the umbracoCacheInstruction table is not being updated to indicate a change to the media item and therefore the front end indexes do not get updated.
I was thinking it's because changes to that property do not trigger a cache update, but it also doesn't update when I change other properties in the same operation.
is working on a reply...