Closed (fixed)
Project:
ImageField
Version:
6.x-3.1
Component:
Miscellaneous
Priority:
Normal
Category:
Support request
Assigned:
Unassigned
Reporter:
Created:
17 Jul 2009 at 01:01 UTC
Updated:
31 Jul 2009 at 17:10 UTC
CCK version: 6.x-2.4
Imagefield version: 6.x-3.1
Download method: public
Expected results: Image will upload and display
Unexpected actual results: Image uploads (I can see the image file saved in my files directory with the correct name: "somename.jpg"); Image won't display because Drupal thinks the image name is: "somename.jpg?1247790513"
Comments
Comment #1
EmmaD commentedI checked the database values and the filepath is actually correct. For some reason Drupal is appending the timestamp to the filepath when it tries to display the image. The ?1247790513 is the timestamp. Any ideas why it would generate the code that way?
Comment #2
quicksketchThe "?1247790513" is the time the image was uploaded. This prevents browser caches from affecting the image if it was deleted, then another image with the same name was uploaded. It doesn't affect the actual retrieval of the image, other than to give it a different URL when a new file is uploaded.
Comment #3
EmmaD commentedIt does affect the retrieval of the image in my case. The image is actually called "somename.jpg". Drupal generates code to view the image as "somename.jpg1247790513". Since this doesn't match the image name, there is no image displayed.
I changed the code for "imagefield.module" to get around this for now. I removed Line 309, "$query_string = $query_character . $file['timestamp'];", and the images display.
The timestamp is appended if this condition is true: if (isset($file['timestamp']))
I would rather prevent Drupal from setting the timestamp than changing the module as I have done. Do you know where to change the timestamp setting?
Comment #4
quicksketchHmm, the "?" really shouldn't make a difference. Drupal does the same thing for CSS files, they must be working or you'd see even worse problems. What's the full URL displayed in the src property for a sample image for you? Perhaps ImageField isn't building the string properly.
Besides fixing this problem, you can also avoid it entirely by overriding the theme_imagefield_image() function. Just copy the entire thing into your theme's template.php, then rename to [nameofyourtheme]_imagefield_image(). Your version will take precedence over the one provided by ImageField module and you can simply remove the timestamp addition entirely.
Comment #5
EmmaD commentedI've solved the problem - it was my own fault. I'm running this as a multi-site configuration and my symiink for the file folder wasn't set up properly. I fixed that problem at the same time as I changed the timestamp code so I thought the problem was the timestamp.
Turns out the imagefield module is great and the ?nnnn doesn't make any differrence.
Sorry for the trouble.
Comment #6
quicksketchOh, well great. Glad to have confirmation regardless. :-)