Magento / Troubleshooting

Magento product thumbnails are not displayed? [SOLVED]

by ,

We have by far the largest RPM repository with dynamic stable NGINX modules and VMODs for Varnish 4.1 and 6.0 LTS. If you want to install NGINX, Varnish, and lots of useful modules for them, this is your one-stop repository to get all performance-related software.
You have to maintain an active subscription in order to be able to use the repository!

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;
        if ($this->_isMemoryLimitReached()) {
            throw new Varien_Exception('Memory limit has been reached.');
        $this->_imageHandler = call_user_func($this->_getCallback('create'), $this->_fileName);


    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.

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.