Closed (fixed)
Project:
ImageField
Version:
6.x-3.0-rc1
Component:
Code
Priority:
Normal
Category:
Support request
Assigned:
Unassigned
Reporter:
Created:
16 Apr 2009 at 03:54 UTC
Updated:
16 Apr 2009 at 05:18 UTC
I just noticed that ImageField seems to be appending a random numerical query to the end of the image src (ex: ?98734978234 - probably just a timestamp). Now the only reason, I know of, that this is done, is to prevent browser caching because the number changes each time - so the browser thinks it's a different image and redownloads.
1) Is that true?
2) Why do that?
3) How do we turn that off (if true)?
My site has over 3,000 images embedded with this module, some pages showing about to 40 at a time. So having them redownloaded each view sucks for me and the user - if this is the case...
Thanks
Comments
Comment #1
quicksketch1) Is that true?
Yes that is true.
2) Why do that?
The string appended is the timestamp the node was last edited. This makes it so that if a user edits a node and uploads an image of the same name, the new image will be displayed and not the old one. The timestamp is only changed if the node is edited, otherwise it stays the same and the browser cache is effective.
3) How do we turn that off (if true)?
If you'd like this not to happen, you can override the theme_imagefield_image() function by copying it to template.php, then renaming it to [mytheme]_imagefield_image, remove the relevant code, then clear the Drupal cache.
Comment #2
quicksketchSorry I was incorrect in my answers:
The string appended is actually the time the file was saved, not the time the node was edited. It still exists for the same purpose though and should not have any negative effect on browser caching.
Comment #3
mstef commentedOh ok..that is fine - and makes perfect sense.
Thanks