Memory allocation error

  • Posts: 52
  • Thank you received: 0
13 years 3 days ago #14878

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?

Last edit: 13 years 3 days ago by icronje.

Please Log in or Create an account to join the conversation.

  • Posts: 81515
  • Thank you received: 13069
  • MODERATOR
13 years 2 days ago #14888

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.

Please Log in or Create an account to join the conversation.

  • Posts: 40
  • Thank you received: 0
12 years 4 months ago #32552

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;
}

Please Log in or Create an account to join the conversation.

  • Posts: 81515
  • Thank you received: 13069
  • MODERATOR
12 years 4 months ago #32560

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.

Please Log in or Create an account to join the conversation.

  • Posts: 40
  • Thank you received: 0
12 years 4 months ago #32567

Merci de l'info. J'ai donc un turn around et je vais discutailler avec l'hébergeur ;-)

à bientôt

Please Log in or Create an account to join the conversation.

Time to create page: 0.076 seconds
Powered by Kunena Forum