If I upload a new version of an image that has the same filename (and dimensions and file size don't seem to matter) via an imagefield in a cck node, imagecache does not display the new version of the image, but keeps the old.
Only if I rename the image before uploading, the new image is displayed.
Comments
Comment #1
eigentor commentedBrowser refresh does not help in neither browser.
Comment #2
dopry commenteddoes the filename not change when it's saved? I'm pretty sure drupal tried to create a new filename if an file by the same name already exists... There may be some need to watch via nodeapi to clear out cached images here....
Comment #3
eigentor commentedIndeed, Drupal creates a new filename, if the same image is saved again. If I do it several times, a filename_0.jpg
and a filename_1.jpg is created. If I continue uploading the same image, the filename_1.jgp is replaced by the new image, it does not count up further.
What do you mean by watch via nodeapi? I'm not a developer...
Comment #4
dopry commentedhmm... this sounds like a bug in core file handling.. I'll see If I can reproduce later today...
Comment #5
eigentor commentedI tracked the problem a little further. Imagecache got it's own folder in the files directory. As I see, the derivates are created the first time a page is called the derivate is displayed on.
When I upload a new Image, Imagecache should notice and replace this image I call the page the next time. But instead, it seems to take the image already stored.
If I delete this file and call the page once more, Imagecache creates a new file, now from the newly uploaded Image and thus correctly.
Appears to have something to do with this: as long as it finds the derivate in its folder it does not seem to check for a new original.
Or better: it does check for a new original, but does not seem to check the upload time stamp (hopefully there is one) or any time stamp or file size, but just the file name.
Comment #6
eigentor commentededit - double post
Comment #7
eigentor commentedAs I learn from this article: http://www.lullabot.com/articles/imagecache_example_user_profile_pictures
The behaviour is not a bug, but normal. Still, it needs fixing. Graciously Nate already provides a solution in the end:
Could this do the trick? Well, surely at least some of the code he used before this is needed to make it work.
Comment #8
dopry commentedhmm.. yeah where ever you're implementing imagecache you have to deal with the flushing. It's a pain in the but I know, but if I spend all my time trying to integrate and support imagecache with everything I'll go insane ;)... I would suggest using a glue module for these types of situations....
Comment #9
eigentor commentedWell, hopefully it will be incorporated into the next version ;) When you hand a site off to a customer, you have to tell them to name the image differently, if they upload a new version. This is a - humm - acceptable workaround, but not on a longer term. Maybe most people just upload the image once and are done, so the behaviour does not get in their way too much. But doing galleries like this: http://portrait-hannover.de/stift/opa-mit-enkelbaby it is quite a pain.
For the moment I managed to instruct her to rename the file every time. But I'll get back to you the next time...
Comment #10
baja_tz commentedsubscribe
Comment #11
vitvas commentedhttp://drupal.org/project/moduleweight (for Drupal 5)
(For example: imagefield weight: 1, imagecache weight: 0)
http://drupal.org/project/util (for Drupal 6)