Currently, when using ImageField to add an image to a node, a query string (in this case, the image's timestamp) is automatically appended to the image's URL. I have tried what quicksketch suggested in the "Image title doesn't match saved image name" issue, but have not been able to get it to work. The code involved is this:
if (isset($file['timestamp'])) {
$query_character = (variable_get('file_downloads', FILE_DOWNLOADS_PUBLIC) == FILE_DOWNLOADS_PRIVATE && variable_get('clean_url', '0') == '0') ? '&' : '?';
$query_string = $query_character . $file['timestamp'];
}
I tried creating a function to override the code in "template.php" (which was a copy of the "theme_imagefield_image" section in "imagefield.module", minus the above section), but it had no effect on removing the timestamp. I also tried renaming the newly-created function to "phptemplate_imagefield_image", as well as "[theme]_imagefield_image" (in this case, "[theme]" would be replaced with "garland"), but neither of those had any effect. The only way I could remove the query string from the image's URL was by removing that code from "imagefield.module". I'm not sure why it works when removed from "imagefield.module", but not when overrode in "template.php".
Could an option be provided to let the user determine whether or not to append this query string to the image's URL?
Other Information:
- CCK Version
- 6.x-2.4
- ImageField Version
- 6.x-3.1
- Download Method
- Public
Comments
Comment #1
quicksketchYou probably just missed a step in there (which I didn't mention in the other issue). After copy/pasting into template.php, rename the function, then clear your Drupal cache at admin/settings/performance (click the Clear all caches button). You must clear the cache after creating any new theming function or .tpl.php file in order for it to be recognized. After that your new function will take precedence over the original.
Comment #2
Wolfey commentedI tried what you mentioned - with "
phptemplate_imagefield_image", as well as with "[theme]_imagefield_image" (clearing the cache before using each one) - and it works for both cases =DThank you very much for clearing this up - I really appreciate it =)
Comment #3
quicksketchGreat, thanks for the confirmation. :-)