V1.4.0 released: Upsell feature, New Product Page, New Stats Module, Security fixes
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
<?php
|
||||
/*
|
||||
* 2007-2015 PrestaShop
|
||||
* 2007-2017 PrestaShop
|
||||
*
|
||||
* NOTICE OF LICENSE
|
||||
*
|
||||
@@ -19,7 +19,7 @@
|
||||
* needs please refer to http://www.prestashop.com for more information.
|
||||
*
|
||||
* @author PrestaShop SA <contact@prestashop.com>
|
||||
* @copyright 2007-2015 PrestaShop SA
|
||||
* @copyright 2007-2017 PrestaShop SA
|
||||
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
||||
* International Registered Trademark & Property of PrestaShop SA
|
||||
*/
|
||||
@@ -107,13 +107,14 @@ class ImageManagerCore
|
||||
|
||||
$memory_limit = Tools::getMemoryLimit();
|
||||
// memory_limit == -1 => unlimited memory
|
||||
if (function_exists('memory_get_usage') && (int)$memory_limit != -1) {
|
||||
if (isset($infos['bits']) && function_exists('memory_get_usage') && (int)$memory_limit != -1) {
|
||||
$current_memory = memory_get_usage();
|
||||
$channel = isset($infos['channels']) ? ($infos['channels'] / 8) : 1;
|
||||
$bits = $infos['bits'] / 8;
|
||||
$channel = isset($infos['channels']) ? $infos['channels'] : 1;
|
||||
|
||||
// Evaluate the memory required to resize the image: if it's too much, you can't resize it.
|
||||
// For perfs, avoid computing static maths formulas in the code. pow(2, 16) = 65536 ; 1024 * 1024 = 1048576
|
||||
if (($infos[0] * $infos[1] * $infos['bits'] * $channel + 65536) * 1.8 + $current_memory > $memory_limit - 1048576) {
|
||||
if (($infos[0] * $infos[1] * $bits * $channel + 65536) * 1.8 + $current_memory > $memory_limit - 1048576) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user