Closed (won't fix)
Project:
ImageCache
Version:
6.x-2.0-beta10
Component:
Code
Priority:
Normal
Category:
Bug report
Assigned:
Unassigned
Issue tags:
Reporter:
Created:
20 Apr 2010 at 09:07 UTC
Updated:
24 May 2012 at 08:11 UTC
Hi all,
I have had a problem with Imagecache and IIS. Digging into the code, I found the (my) problem. The function imagecache_create_url, on line 321 has the following code:
return url($GLOBALS['base_url'] . '/' . file_directory_path() .'/imagecache/'. $presetname . '/' . $path, $args);
If $path has a leading slash, this creates a URL that has two slashes together. IIS does not seem to like this. Removing the extra slash between $presetname and $path, it works perfectly for me:
return url($GLOBALS['base_url'] . '/' . file_directory_path() .'/imagecache/'. $presetname . $path, $args);
Does anybody know if $path has always a leading slash? Should this be checked before creating the URL, so that always a single slash is included?
Maybe this should be done too in the case of FILE_DOWNLOADS_PRIVATE, but I do not have any configuration with private downloads and IIS to test it.
Cheers,
Pedro
Comments
Comment #1
DissidentFool commentedI have the same double slash problem, only using various windows and linux versions of Apache, PHP, etc (so not an IIS specific issue). I personally found that adding the following line (obviously without php tags):
just before the return in the function
_imagecache_strip_file_directory, inimagecache.moduledid the trick. I prefer to test for a leading slash and then remove it, rather than just drop a slash arbitrarily, as the normal code obviously works in some (most?) cases, so just removing a slash will likely break something else.Comment #2
jaxxed commentedI like dissidentfool's solution. I would code it with stronger php declaration:
if (substr($path, 0, 1) == '/') { $path = substr($path, 1); }?>
The patch would look something like ($ svn diff imagecache.module )
I'll mark this for review
Comment #3
verta commentedsubscribing
Comment #4
jaxxed commentedI'll contact the module developor to see if he'd mind me applying this patch.
Comment #5
fizk commentedReopen if this is still an issue.