While using imagePlus for image TV’s (with it’s handy cropper), a new version of an image with the same name does not show in the preview thumbnail in the TV, nor in the cropper tool, nor in the page containing it. The previous version of the image is still used in all instances.
This must be a caching issue.
How can I resolve this without renaming the image each time I want to try a new version of the image?
Could be your own browser caching the image. Try clearing your browser disk cache (not cookies), and also “saved data” cache if there is one.
One other possibility: If you are using CloudFlare (or some other content delivery network), these images will be cached there as well, so you have to clear the CDN cache.
I’m using ModX 3.05 on ModxCloud. I’m sure it’s not caching in the browser as I have the inspector open and disable caching is checked (with modX manager)
It’s in the manager that the problem arises at first. Even when I clear the imageTV and save the resource, then set it to the new image (with same name), it shows the previous version of the image. In the cropper and the final web page as well.
You have to delete the cached image, probably in the folder /assets/components/phpthumbof/cache/
Thanks for answering, but that is not very convenient for an Editor with insufficient rights to do that every time a new image is uploaded.
Yes you are right. I thought it might be a one time solution. There are some system-settings regarding the cache of phpthumb, like setting_phpthumb_cache_source_enabled or phpthumbof.check_mod_time if you use pthumb.
phpthumbof.check_mod_time seems to do the trick - somewhat. The final image in the page shows the new one but the thumbnail in the TV and the cropper image show the old one.
And I’m not sure what the remark beneath it means.
Will all thumbnails be regenerated when one is updated?? I mean what kind of access does it intend?
Is “pthumb.clean_level” now set to 0? As a test, you can set it to 2, which will then delete all the cached images when you do a regular Clear Cache in MODX.
If that fixes the problem (you still may need to clear your own browser’s disk cache), then you know the problem lies in the phpthumb cache.
I remember having this issue once. Maybe the url for the cropped image can be extended with some version hash. I try to check that the next weeks.
That would be awesome
This can easily be your browser’s cache. That’s exactly what I have encountered in the past. There is more than one cache to be cleared. For example, when you clear a cache in Chrome (and Chrome-based browsers), you need to clear three caches:
Safari has a simple “Clear History” command that doesn’t clear everything. If you turn on the developer tools, there will be a “Clear Caches” item under the Develop menu that clears all cached files.
What browser are you using?
Also, MODX puts the media browser thumbnails in its own cache, but those should go away when you clear the site cache, if I remember correctly.
FYI:
Are you sure that disables the offline storage cache, not just the “disk cache”?
Yes, that message is kind of weird. It should really just delete the cached versions of just images that have been updated, but the second sentence implies that it clears the whole cache. Does anyone know what actually happens?
Thanks, I will check this later
Going to play devil’s advocate…
From the perspective of “We have no control over our site visitors’ browser cache” – the safest process is to use a new image filename if there’s a new image uploaded to replace an old one.
What would be an awesome extra, would be one that can find all instances of an image filename and update it to a new image filename.
Totally agree! Done that many times myself.
I would indeed give the image a new name as well. But our designer sometimes tries multiple versions of an image before she’s satisfied with the result. That just does not work. Now she unconveniently has to rename the image and delete the old one every time.
Still hoping for @jako to make this work with imagePlus.
Why does she have to delete the old one? I don’t see any urgent reason, other than saving some disk space.
And which takes more time, deleting an old image, or having to clear multiple caches every time an image is updated?
Not deleting one unused file is no problem but hey we’ve got more than one image Indeed saving disk space and preventing clutter is the goal. In fact for every image several responsive sizes are generated, so disk space is precious.
Clearing caches every time isn’t feasible either.