I can't upload images on my CMS home page, it says "Memory limit has been reached", i've been searching on internet a fix, and i found this one saying to change this code on Gd2.php ( /lib/Varien/Image/Adapter/Gd2.php ) :
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;
}
to
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
}
(Yes i removed the commentary codes )
but in my Gd2.php the code is different, here's the code i have:
protected function _convertToByte($memoryValue)
{
$memoryValue = trim($memoryValue);
if (empty($memoryValue)) {
return 0;
}
if (preg_match('~^([1-9][0-9]*)[\s]*(k|m|g)b?$~i', $memoryValue, $matches)) {
$option = strtolower($matches[2]);
$memoryValue = $matches[1];
switch ($option) {
case 'g':
$memoryValue *= 1024;
// no break
case 'm':
$memoryValue *= 1024;
// no break
case 'k':
$memoryValue *= 1024;
break;
default:
break;
}
}
$memoryValue = (int)$memoryValue;
return $memoryValue > 0 ? $memoryValue : 0;
}