Closed (won't fix)
Project:
Imagefield Gallery
Version:
5.x-2.0-alpha1
Component:
Code
Priority:
Minor
Category:
Feature request
Assigned:
Reporter:
Created:
18 Jun 2008 at 12:01 UTC
Updated:
25 Jul 2008 at 05:30 UTC
In imagefield_gallery_lightbox2.module function theme_imagefield_gallery_lightbox2 there is bad code for URL creation.
This part
if ($preview == '_original') {
$imagecache_path = base_path() . $file['filepath'];
}
else {
$imagecache_path = base_path() . file_directory_path() .'/imagecache/'. $preview .'/'. $file['filepath'];
}
should be
if ($preview == '_original') {
$imagecache_path = file_create_url($file['filepath']);
}
else {
$imagecache_path = imagecache_create_url($preview,$file['filepath']);
}
There is no reason for building our own URLs when there are standard functions for this.
And I hope convergence with lightbox2 module goes on so things like this don't happen. This code is correctly working in lightbox2 module.
Comments
Comment #1
eclipsegc commentedSorry, it's hard to become an expert in all the details of every module one might need to understand before setting out to build their own module on the first pass. I'll make sure this makes it into the 2.x alpha.
Thanks!
Eclipse
Comment #2
eclipsegc commentedSo, this code you've submitted is imagecache 2.0 only. It's important to note that right now I'm still supporting imagecache 1 and imagefield 1 ALONG WITH the 2.x version of both those modules. Got some code that will handle both of them?
Eclipse
Comment #3
Farreres commentedNo idea. There is the module_exists function, perhaps there is some module_version equivalente so you can ask for imagecache 2.0 or greater and then use this code. Otherwise use old code. Just an idea.
Comment #4
Farreres commentedHey, I just saw this new module:
http://drupal.org/project/modver
It will help developers know the module version installed. This way the problem of knowing if imagecache 1 or 2 is installed could be solved.
Comment #5
dobeerman commentedIf use original code:
Link to thrumbnail
http://mysite.ru/files/imagecache//files/gallery/1/1659.jpgIf use patch:
Link to thrumbnail
http://mysite.ru/files/imagecache/%252Fgallery/1/1659.jpgwhy $preview is empty?
PS. /1/ = uid
Comment #6
eclipsegc commentedBeerman,
If you've made use of the code in this issue, it is specific to imagecache 2.x ONLY! If you're using imagecache 1.x it will NOT work. Which is exactly why this code will not be making it into the next release cycle.
Eclipse
Comment #7
dobeerman commentedImageCache 5.x-2.1
Comment #8
eclipsegc commentedBeerman,
Well, as I only did enough research to see that this code wouldn't work with 1.x I never tested it with 2.x, so this is NOT a supported alteration of the module. Why are you trying to alter it at all? The existing code works just fine.
Eclipse
Comment #9
eclipsegc commented