yum
upgrades for production use, this is the repository for you.
Active subscription is required.
Magento 1.x is a popular Ecommerce solution. Like any software, it is subject to bugs. Quite a number of times you may find that Magento product thumbnails will not appear. We will list possible solutions to the problem here:
Magento bug with memory_limit
PHP setting
In case you don’t have the latest patched version of Magento 1.x, it may not support specific values of memory_limit
PHP setting. Specifically, Magento would fail to generate product thumbnails when the memory limit is set in gigabytes, or to a special value of -1.
Solution here is to patch the code yourself. It is quite safe and easy to do.
Open up /lib/Varien/Image/Adapter/Gd2.php
and replace the functions open
and _isMemoryLimitReached()
with the bug free versions:
public function open($filename)
{
$this->_fileName = $filename;
$this->getMimeType();
$this->_getFileAttributes();
if ($this->_isMemoryLimitReached()) {
throw new Varien_Exception('Memory limit has been reached.');
}
$this->_imageHandler = call_user_func($this->_getCallback('create'), $this->_fileName);
}
and
protected function _isMemoryLimitReached()
{
$limit = $this->_convertToByte(ini_get('memory_limit'));
/**
* In case if memory limit was converted to 0, treat it as unlimited
*/
if ($limit === 0) {
return false;
}
$size = getimagesize($this->_fileName);
$requiredMemory = $size[0] * $size[1] * 3;
return (memory_get_usage(true) + $requiredMemory) > $limit;
}
That’s it. Once this is done Magento should have no issue generating thumbnail images.