Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Thomas Beckert 193 posts 469 karma points
    Jun 28, 2021 @ 08:05
    Thomas Beckert
    0

    Delete media Image does not delete ImageProcessor Cache -kind of bug?

    Hi there,

    we had a problem with a copyright-protected image. Our client got served noticed to remove the image and had to pay a fine. Some month later, our client got served noticed for the exact same image we already removed. The problem was, that it was still in the cache of the image processor and could be called by a crop-URL. And now, I just checked it again.

    I deleted a pic - accessible before under this url: https://www.hotel-buergerstuben.de/media/vkrdue2c/steak.jpg

    As you can see - it is removed. But if I add a used crop URL, you still can call the image: https://www.hotel-buergerstuben.de/media/vkrdue2c/steak.jpg?anchor=center&mode=crop&width=1280&height=700&rnd=132692703894230000

    I think this is not really as it should work - and I don't want to clear the complete cache-folder just to get rid of one single image.

    Has anyone an idea? Is this maybe kind of a bug?

    I'm looking forward to the discussion and hopefully to the solution for this circumstance.

    All the best -

    Tom

  • Jason Elkin 38 posts 351 karma points MVP 2x c-trib
    Jun 28, 2021 @ 09:03
    Jason Elkin
    0

    Hi Thomas,

    What an interesting situation!

    TL;DR; you'll need to delete the whole cache.

    It's not a bug, ImageProcessor (which is what Umbraco uses to handle these image URLs) just can't do this.

    All the ImageProcessor cache does is look at the URL, see if it's already processed an image for that URL and return it, or return a freshly processed image and cache it for later.

    Images are stored in the cache against a hash of the URL, which means that if any part of the URL changes, you'll end up with a different resized version of the image in the cache. Perhaps you've used this image elsewhere on the site at a different size, or different versions of the page (notice the "rnd" part of the querystring) so you could have lots of other copies of this image in your cache.

    Because the cache is based on one-way hashes you can't tell from the cache itself what the original URL was, so there's no way to, for example, delete all images that start with "https://www.hotel-buergerstuben.de/media/vkrdue2c/steak.jpg". There's also no way to logically link a given media item in Umbraco with a URL in the cache.

    Clearing the complete cache shouldn't be a big problem. Caches like this are supposed to be transient and it's not a bad idea to clear it out every now and then (depending on traffic) to make sure you're not wasting storage on images that are not being used any more.

  • Thomas Beckert 193 posts 469 karma points
    Jun 28, 2021 @ 14:46
    Thomas Beckert
    0

    Hi, Jason,

    thanks for your quick reply. Well, this is indeed an issue, we have to focus on. So if there is no way to get a connection between the media item and the cached one, we will clear the cache every time, a media item is deleted.

    Anyway, we have to add this to each of our umbraco sites. So my question to the community: makes this really sense?

    If you running a large site and your customers are in trouble due to a copyright issue, that have to rely on the system, that the image is really deleted. Otherwise, I would say, you as CMS provider, are in charge of this issue.

Please Sign in or register to post replies

Write your reply to:

Draft