You'll see the image is being resized, and a new file is added somewhere in the MediaCache folder (difficult to see as the files are hashed)
Next time a request comes in for that image with those specific querystrings, the url will be hashed, and the cache version retrieved from the media cache...
... so in your circumstance, it isn't so much 'how do I restore the mediacache' that is the issue, it is more, why isn't my image being resized...
Media cache not found
I've had an accident on a website, running Umbraco 12.0.1 and I had to restore some files from the hosting backup.
Now that everything is back in it's place, I have a problem with cached media that doesn't exists.
How do I create new cached files ?
Cached file that doesn't exists: https://hedenstedfotoklub.dk/media/werpjeka/21-06-kgs.jpg?rxy=0.37743107346478094,0.2944656811154796&width=570&height=285&v=1d965c4e161f8f0
Actual file that works fine: https://hedenstedfotoklub.dk/media/werpjeka/21-06-kgs.jpg
Hi Sebastian
The MediaCache folder consists of copies of images after the have been processed by ImageSharp...
So if an image is request on the site directly to the image eg
https://hedenstedfotoklub.dk/media/werpjeka/21-06-kgs.jpg
this doesn't use the MediaCache, and will not create anything in the cache
but if you add resize instructions
https://hedenstedfotoklub.dk/media/werpjeka/21-06-kgs.jpg?width=570&height=285
You'll see the image is being resized, and a new file is added somewhere in the MediaCache folder (difficult to see as the files are hashed)
Next time a request comes in for that image with those specific querystrings, the url will be hashed, and the cache version retrieved from the media cache...
... so in your circumstance, it isn't so much 'how do I restore the mediacache' that is the issue, it is more, why isn't my image being resized...
eg
the version that contains the 'v=' fails
https://hedenstedfotoklub.dk/media/werpjeka/21-06-kgs.jpg?rxy=0.37743107346478094,0.2944656811154796&width=570&height=285&v=1d965c4e161f8f0
it failed without the v parameter too
https://hedenstedfotoklub.dk/media/werpjeka/21-06-kgs.jpg?rxy=0.37743107346478094,0.2944656811154796&width=570&height=285
but we saw just the width and height on it's own worked correctly, if I adjust the rxy point to round up the decimals
https://hedenstedfotoklub.dk/media/werpjeka/21-06-kgs.jpg?rxy=0.4,0.3&width=570&height=285
it is also fine, so is it something to do with the length of the decimals???
hoping that helps!
regards
Marc
That's odd, because I just generate the image url like this:
The example above is slightly simplified :)
Yes, so why is
Url.GetCropUrl generating a Url that isn't being processed!
What happens if you upload the image afresh as a new media item and pick in here... ?
If I remove the original, and re-upload it, the cache is rebuild and everything looks fine.
But I hope there is a way to rebuild the cached media files, other than upload them one by one.
Hi Sebastian
So that shows there isn't an issue with the image itself and the getcropurl instruction...
And if you vary any single character in the Url it seems to work...
so I think the issue is the hash of those exact parameters is matching something in your media cache that is corrupted...
So I think if you delete the contents of the media cache folder, that should remove the corruption on this file...
But will cause all images on the site to need to be processed again, and the media cache folder will build back up overtime
Regards
Marc
Thanks Marc,
I just renamed the MediaCache folder to something else. That forced Umbraco to generate new cached files.
is working on a reply...