Hello
While using this module on Linux I encountered a problem in the function _imagecache_mkdir($dir) (File: imagecache.module, Line 429). Using an absolut path, the leading slash is not written. So basically the first run of the foreach starts with an empty string. It's not a dir and not a file and fails at mkdir() at line 448.
Blame me, but maybe it happens only on my machine?
Anyway, I'd be happy if somone could have a look at it.
Following is my version of that function which works for me:
function _imagecache_mkdir($pathname) {
is_dir(dirname($pathname)) || _imagecache_mkdir(dirname($pathname), 0775);
return is_dir($pathname) || @mkdir($pathname, 0775);
}
Cheers
Nexo
Comments
Comment #1
pete-drupal commentedI can reproduce your problem in my environment
and
The watchdog contained the error message:
"Could not create destination: %dir halted at: %path"
where
%dir was some absolute path (starting with '/')
%path was empty!
I solved it by modifying the function
_imagecache_mkdirin fileimagecache.moduleas follows:I would have created and attached a patch file, but forgot to check-in the original version of the module in my repository.
Note: according to http://www.php.net/mkdir, PHP5 is the first version that can create directories recursively while applying a 'chmod'
So, I guess the main reason why the function
_imagecache_mkdiris iterating is to preserve PHP4 compatibility and possibly to output specific conditions to the watchdog?Comment #2
pete-drupal commentedTested successfully
Comment #3
dopry commentedTotally not concerned about php compat... I totally switched to mkdir... /me is so happy... thanks for reminding me pete. I was orignally trying to maintain php compat, but I dropped it... tnx. test the next dev snapshot for me, or CVS(DRUPAL-5--2) if you can.
Comment #4
pete-drupal commentedHere is how I tested:
Conclusion: Successfully tested. Feel free to close the issue.
Comment #5
Anonymous (not verified) commentedAutomatically closed -- issue fixed for two weeks with no activity.