Jako / ImagePlus

Advanced Image Custom TV in MODX Revolution
https://jako.github.io/ImagePlus/
GNU General Public License v2.0
29 stars 20 forks source link

Thumbnail cache is not cleared when replacing image with the same filename #87

Open travisbotello opened 4 years ago

travisbotello commented 4 years ago

When replacing an existing Image+ image file with a new image using the same file name the phpthumb in the backend is not showing the new image.

How to reproduce

  1. Create a TV using image+
  2. Set an image in the image+ TV, crop it and save the resource
  3. Upload a new image with exactly the same filename (you can remove the previous image) and set it in the image+ TV => preview area is still showing the first image

Problem seems to be in the used image src: /connectors/system/phpthumb.php?wctx=mgr&w=400&source=2&src=categories%2Fhome-600x510px.png&sw=600&sh=510&sx=0&sy=0

Jako commented 4 years ago

Thats an issue of the phpthumb connector and maybe can't be solved inside of Image+. I will look for this.

travisbotello commented 4 years ago

Interesting...thanks for the update!

Jako commented 4 years ago

Could you try to attach a random url parameter, to look wether this forces a reload of the thumbnail (then it is a browser caching issue)? If not, this can't be solved in Image+ and (maybe) not with the default phpthumb connector.

travisbotello commented 4 years ago

Just tried that. Attaching &v=1 to the filename refreshes the thumbnail correctly.

<img src="/connectors/system/phpthumb.php?wctx=mgr&amp;w=400&amp;source=2&amp;src=categories%2F40x40.png&amp;v=1&amp;sw=640&amp;sh=425&amp;sx=0&amp;sy=0" id="ext-comp-1035">

Jako commented 4 years ago

Then it is maybe just a browser caching issue. This could be solved by Image+ and other extras with a parameter hash including the file date/size.

travisbotello commented 4 years ago

That makes sense. Currently I set filesluggy to automatically add unique hash to any uploaded file which is basically having the same effect.

Jako commented 4 years ago

But then you maybe have a lot of duplicated files.

travisbotello commented 4 years ago

True, that is not ideal. But currently my clients prefer that options so they don't have any issues with caching when replacing images with the same file name...