Hello there,

I've just started creating a website with Drupal 6 and installed your module for use with CCK. An issue I had with another module lead me to set the file system to private. I then realized that my images were not correctly printed.

After searching a bit I think I've found the cause within imagefield.module's code. The module appends a timestamp to the filename in order to ensure that it is regularly updated. However you append this extra info always with a question mark. If file system is set to private this can lead to issues, since you should be using an ampersand (the file path being the first parameter):
http://mysite/drupal6/?q=system/files/images/news/example_0.jpg?1238174075
should be
http://mysite/drupal6/?q=system/files/images/news/example_0.jpg&1238174075

I changed the code just a bit (cf. patch) in order to get going. Based on your CVS diffs that's the only place where the timestamp is appended.

Hope this helps!

Comments

quicksketch’s picture

Thanks for this patch! It does look like you're correct. However, the patch you've provided wouldn't work if the site had clean URLs turned on. In fact if possible, you should turn on Clean URLs (admin/settings/clean-urls), and then you wouldn't need the patch either. This is still definitely a problem, though it only occurs if your file system is private AND you don't have clean URLs turned on.

quicksketch’s picture

StatusFileSize
new975 bytes

Could you try out this patch and see if it fixes your problem? Thanks!

quicksketch’s picture

Status: Needs review » Fixed
StatusFileSize
new973 bytes

I had a typo in my variable name. The clean urls variable is "clean_url", not "clean_urls", so the check wasn't working properly. I went ahead and tested this out with all the combinations of private/public and clean/not clean URLs, then committed it.

acp’s picture

Well I was testing it too in the meantime :). I couldn't get public working correctly with imagecache (that's why I had turned private on in the first place).
I guess that I'll turn clean urls on (I didn't see the use in it for my dev server but since I'm gonna use it on production, why not do it now...).

I'll be opening an issue with imagecache devs who do the exact same thing in their module. I'm wondering, isn't there a drupal function for this kind of things (aka add_url_parameter or something of that sort)?

Anyway, thanks for the fix.

quicksketch’s picture

I'm wondering, isn't there a drupal function for this kind of things (aka add_url_parameter or something of that sort)?

I'd thought there'd be one too, but apparently not. Though it'd be a great core feature request. ;-)

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.