Friday, July 10, 2020

For memory limit issue while uploading the product image in magento 1


For memory limit issue while uploading the product image




Go To lib/Varien/Image/Adapter open Gd2.php


Now search for method protected function _convertToByte($memoryValue) i.e

protected function _convertToByte($memoryValue)
{
    if (stripos($memoryValue, 'M') !== false) {
        return (int)$memoryValue * 1024 * 1024;
    }
    elseif (stripos($memoryValue, 'KB') !== false) {
        return (int)$memoryValue * 1024;
    }

   return (int)$memoryValue;
}
Make the following changes in the above method like :

protected function _convertToByte($memoryValue)
{
     /*
     if (stripos($memoryValue, 'M') !== false) {
         return (int)$memoryValue * 1024 * 1024;
     }
     elseif (stripos($memoryValue, 'KB') !== false) {
         return (int)$memoryValue * 1024;
     }

     return (int)$memoryValue;
     */
     return 2147483648;
     //1024*1024*1024*2 = 2G
}
Hope this will help someone :)

No comments:

Post a Comment