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

quicksketch’s picture

1) 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.

quicksketch’s picture

Sorry I was incorrect in my answers:

The string appended is the timestamp the node was last edited.

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.

mstef’s picture

Status: Active » Closed (fixed)

Oh ok..that is fine - and makes perfect sense.

Thanks