Closed luemic closed 8 years ago
After some diggin I found that Netzarbeiter_NicerImageNames_Model_Image::setBaseFile($file) is the cause for the trouble.
In what way? What is your file name template configuration? What is the original file name?
I could reproduce the issue with the default configuration on a standard Magento 1.9.0.1 and the base configuration of the module. I Think it's related to
// Check that generated filename is not longer than 255
$maxfilelen = 255;
if (strlen(basename($file) . $extension) > $maxfilelen) {
$file = substr($file, 0, ($maxfilelen - strlen($extension) + strlen(dirname($file))));
$file = $file . '.' . $extension;
}
What OS are you running on? That code is so old, it has been running fine for me for years on OS X and CentOS at least.
OS is Ubuntu 14.04
How deep is your directory tree? Maybe the directory path is already longer then 255 characters?
That code should just restrict the filename and not the full path.. there is another check just below that to restrict the directory (default max length of 1024) which I think is more likely to be the issue. Could you check what PHP_MAXPATHLEN
is set to?
My fault for not doing those unit tests :8ball:
Unfortunately the code in question is not covered by tests. I wrote the module before I started with those.
Looking through the code, I must admit it is a mess.
Regarding your question though, PHP_MAXPATHLEN
is set to 1024
on OS X and CentOS.
Note that the method \Netzarbeiter_NicerImageNames_Model_Image::setBaseFile()
is actually executed twice. Once before \Netzarbeiter_NicerImageNames_Model_Image::$_niceCacheName
is set, and once after.
The first time happens while \Mage_Catalog_Helper_Image::init()
executes line 163.
The second time happens while \Mage_Catalog_Helper_Image::__toString()
executes line 352.
In the first run the resulting image file name is indeed just a directory with only the file name extension.
The second time the generated image name is set and used.
Just something to keep in mind while debugging - you want to see the state during the second execution of \Netzarbeiter_NicerImageNames_Model_Image::setBaseFile()
, because those are the values that end up being used.
Argh, someone installed a conflicting extension on the "clean" system, so the error occured on this system as well. Fixing the conflict fixed the empty images problem :). Sorry for any inconvenience.
Thanks for the update, glad it's resolved!
Hi, I got the following issue with this extension in Magento version 1.9.0.1 the filename of the cached images is empty e.g.
Kind regards
Michael