- Posts: 52
- Thank you received: 0
Memory allocation error
15 years 5 months ago - 15 years 5 months ago #14878
by icronje
Memory allocation error was created by icronje
I get the following error when trying to upload a product image for a product.
Fatal error: Allowed memory size of 33554432 bytes exhausted (tried to allocate 17472 bytes) in /home/lesswhkd/public_html/administrator/components/com_hikashop/helpers/image.php on line 316
Can anyone assist?
Fatal error: Allowed memory size of 33554432 bytes exhausted (tried to allocate 17472 bytes) in /home/lesswhkd/public_html/administrator/components/com_hikashop/helpers/image.php on line 316
Can anyone assist?
Last edit: 15 years 5 months ago by icronje.
Please Log in or Create an account to join the conversation.
15 years 5 months ago #14888
by nicolas
Replied by nicolas on topic Re: Memory allocation error
Hi,
That's because you're trying to upload images too big. You have several options:
1. reduce the size of your images before uploading them.
2. deactivate the thumbnail/watermark/image size options of the "files" tab of the config.
3. ask your hosting company to increase the memory_limit of your PHP settings.
That's because you're trying to upload images too big. You have several options:
1. reduce the size of your images before uploading them.
2. deactivate the thumbnail/watermark/image size options of the "files" tab of the config.
3. ask your hosting company to increase the memory_limit of your PHP settings.
Please Log in or Create an account to join the conversation.
14 years 9 months ago #32552
by jlhosch
Replied by jlhosch on topic Re: Memory allocation error
Bonjour Nicolas,
J'ai rencontré la même erreur que décrite dans ce post : sur un hébergement dont la limite mémoire dans le php.ini était de 128M (OVH), le chargement d'images de 4Mo passe nickel.
sur l'hébergement live de mon client, cette limite était fixée à 24M ==> forcément, ça coince, mm sans watermark.
Pour que cela fonctionne, j'ai modifié le script /administrator/components/com_hikashop/helpers/image.php de la façon décrite ci-dessous ; est-ce suffisamment propre et correct ? y a-t'il un moyen de repositionner la valeur par défaut de manière générique ?
:
function scaleImage($x,$y,$cx,$cy) {
/* GG 20111213 allocation mem max spécifique */
ini_set("memory_limit","128M");
/* GG 20111213 fin allocation mem max spécifique */
if(empty($cx)){
$cx = 9999;
}
if(empty($cy)){
$cy = 9999;
}
if ($x>=$cx || $y>=$cy) {
if ($x>0) $rx=$cx/$x;
if ($y>0) $ry=$cy/$y;
if ($rx>$ry) {
$r=$ry;
} else {
$r=$rx;
}
$x=intval($x*$r);
$y=intval($y*$r);
return array($x,$y);
}
/* GG 20111213 repositionnement limite memoire */
ini_set("memory_limit","24M");
/* GG 20111213 fin repositionnement limite memoire */
return false;
}
J'ai rencontré la même erreur que décrite dans ce post : sur un hébergement dont la limite mémoire dans le php.ini était de 128M (OVH), le chargement d'images de 4Mo passe nickel.
sur l'hébergement live de mon client, cette limite était fixée à 24M ==> forcément, ça coince, mm sans watermark.
Pour que cela fonctionne, j'ai modifié le script /administrator/components/com_hikashop/helpers/image.php de la façon décrite ci-dessous ; est-ce suffisamment propre et correct ? y a-t'il un moyen de repositionner la valeur par défaut de manière générique ?
:
function scaleImage($x,$y,$cx,$cy) {
/* GG 20111213 allocation mem max spécifique */
ini_set("memory_limit","128M");
/* GG 20111213 fin allocation mem max spécifique */
if(empty($cx)){
$cx = 9999;
}
if(empty($cy)){
$cy = 9999;
}
if ($x>=$cx || $y>=$cy) {
if ($x>0) $rx=$cx/$x;
if ($y>0) $ry=$cy/$y;
if ($rx>$ry) {
$r=$ry;
} else {
$r=$rx;
}
$x=intval($x*$r);
$y=intval($y*$r);
return array($x,$y);
}
/* GG 20111213 repositionnement limite memoire */
ini_set("memory_limit","24M");
/* GG 20111213 fin repositionnement limite memoire */
return false;
}
Please Log in or Create an account to join the conversation.
14 years 9 months ago #32560
by nicolas
Replied by nicolas on topic Re: Memory allocation error
Nous ne pouvons pas faire cela par défaut dans HikaShop car l'appel à ini_set sur certains hébergeurs peut faire crasher les pages (nous en avions auparavant et les avons supprimé justement à cause de cela).
Le mieux est d'avoir un php.ini configuré avec une limite mémoire suffisante.
Le mieux est d'avoir un php.ini configuré avec une limite mémoire suffisante.
Please Log in or Create an account to join the conversation.
14 years 9 months ago #32567
by jlhosch
Replied by jlhosch on topic Re: Memory allocation error
Merci de l'info. J'ai donc un turn around et je vais discutailler avec l'hébergeur 
à bientôt
à bientôt
Please Log in or Create an account to join the conversation.
Time to create page: 0.147 seconds