Closed (cannot reproduce)
Project:
ImageCache
Version:
6.x-2.0-beta9
Component:
Code
Priority:
Normal
Category:
Bug report
Assigned:
Unassigned
Reporter:
Created:
18 Jul 2009 at 00:28 UTC
Updated:
24 May 2012 at 06:51 UTC
The preset preview doesn't show the image. Apache2 logs indicate a 404 on ../files/imagecache/thumb/imagecache_sample.png and if you manually create that dir/image it gets automatically deleted when reloading the preview.
Note: The imagecache_sample.png is saved in files/ not files/imagecache/
Comments
Comment #1
nestor718 commentedLook at this thread for ideas ..
http://drupal.org/node/410200#comment-1822478
Comment #2
rewted commentedSeems to be all IIS stuff. Besides, the developers need to fix the issue in their release. Clearly I am not the only one experiencing this.
Comment #3
nestor718 commentedNa, it's not IIS stuff but the mod I put in works with IIS something that doesn't seem to get much support from the apache crowd. But the problem you're having is the same across all the platforms in that they rely on too many factors to be "just right" to work. I've searched for answers for days and some even try work arounds modifying their .htaccess files to some looney settings that will in no way work for anyone else.
But the developers have been aware of these issues since at least 2007 because that's the oldest post pointing out this bug. Basically, they're working on integrating with drupal 7 so I don't think there's going to be much work done on the existing module.
Anyway, try this modification in your imagecache.module file, it should work with apache:
Comment #4
nestor718 commentedNote: The imagecache_sample.png is saved in files/ not files/imagecache/This is the nature of the bug. When your system is set to public downloads, imagecache thinks the file is there so it will never move it to the destination path. You have to 'trick' the imagecache fuction (when in public downloads) that the path is non-existent so it will then move the source file to the temp dir, modify it and then move to the final destination.
For all that to work in the module's default configuration an number of factors have to be true, some of which might not be possible on every system. The above hack restores intended functionallity via a boolean test that will conclusively determine what method to use to produce the desired results.
Comment #5
rewted commentedNot sure how to implement this into the module code. Do I just go to end of the file and add:
function imagecache_create_url($presetname, $filepath, $bypass_browser_cache = NULL) {
$path = _imagecache_strip_file_directory($filepath);
if (module_exists('transliteration')) {
$path = transliteration_get($path);
}
$query = $bypass_browser_cache ? time() : $bypass_browser_cache;
switch (variable_get('file_downloads', FILE_DOWNLOADS_PUBLIC)) {
case FILE_DOWNLOADS_PUBLIC:
if (file_exists($_SERVER["DOCUMENT_ROOT"] . "/" . file_directory_path() .'/imagecache/'. $presetname .'/'. $path)) {
return url($GLOBALS['base_url'] . '/' . file_directory_path() .'/imagecache/'. $presetname .'/'. $path, $query, NULL, TRUE);
} else {
return url('system/files/imagecache/'. $presetname .'/'. $path, $query, NULL, TRUE);
}
case FILE_DOWNLOADS_PRIVATE:
return url('system/files/imagecache/'. $presetname .'/'. $path, $query, NULL, TRUE);
}
}
Comment #6
nestor718 commentedIt's in the file 'imagecache.module' around line 216
You'll see this:
Replace with this exactly:
Make a copy of the existing one for back up and roll back if need be. Also, you'll have to get the {} correct or you'll get a parse error.
Comment #7
rewted commentedIt was on line 310. I've excluded the ?php part as they only appear at the top and bottom of the file. The following error is returned when adding a preset.
Fatal error: Unsupported operand types in /var/www/domain.com/includes/common.inc on line 1386
Going back, the preset is then listed there. But when trying to then edit the preset, same error.
Fatal error: Unsupported operand types in /var/www/domain.com/includes/common.inc on line 1386
Any idea?
Comment #8
troublescoot commentedHey guys, I had the exact same problem and tried enabling the ImageAPI GD2 module. It worked perfectly after that, no modifications to the code. Hope this helps.
Comment #9
rewted commentedThat has nothing to do with the issue, but thanks.
Comment #10
rewted commentedBump, #7 requires an answer still.
Comment #11
rewted commentedAfter a week of fiddling around, I have a fix for this issue. Check out this thread: http://drupal.org/node/536596
Comment #12
FrankT commentedI have the same problem with the error message in #7, too. The fix mentioned (#536596: Imagecache FIX for images being created in wrong location) does not help. The files are created in the directory files directly instead of the appropriate subdirectory.
Comment #13
FrankT commented...setting this issue on critical because this error causes the module not to do what it is meant for...
Comment #14
sholn commentedtry to enable clean urls it worked for me
Comment #15
FrankT commented... I already had clean URLs enabled ...
Comment #16
marcofabian commentedIt works now, in my case, I enabled the Image API GD2
Comment #17
errorist commentedThat solved my problem :)
Thanks
Comment #18
moxwai commentedYeh enabling clean URL's fixed this for me. I'm using Bluehost and to get clean-urls going i had to make sure there was a .htaccess in the root of my drupal install that included the line:
RewriteBase /~bluehost_username/dressagetaranaki.co.nz
dressagetaranaki.co.nz being the name of the sub folder my site is in the root of bluehost.
Then i enable clean-urls, went back to my view and image cache images were all there! woo &#%(#@* hoo!
Comment #19
robbertnl commentedSame issue. Solutions not working here (like FrankT ) Tryed the latest release and the latest dev version. Clean urls are enabled, Image API GD2 also enabled
Comment #20
fizk commented