Jump to content

Allowed memory size of ImageAnimatedGif


benbyf
 Share

Recommended Posts

Running into Error: Allowed memory size of 268435456 bytes exhausted (tried to allocate 12288 bytes) (line 190 of /srv/users/serverpilot/apps/hortons/public/site/modules/ImageAnimatedGif/ImageAnimatedGif.module)

I'm running PW 3.0.42. Not come across this before on a image field with a gif uploaded, anyone have any insight?

Thanks

Link to comment
Share on other sites

Is the DPI of the GIF very high? I know this can occur with jpegs when the server tries to create a thumbnail of hi-dpi images that just exhaust the resources of the hosting account / server.

 

I have successfully uploaded animated gifs before to PW, they were around <1.5mb and 72DPI

 

 

Link to comment
Share on other sites

gif's dont store dpi data, however I did manage to upload a tiny giff and its works but over 2mb its crashing, is it maybe a memory allocation setting somewhere that needs increasing? I'm running Nginx

Link to comment
Share on other sites

5 minutes ago, kixe said:

If you need a quick solution try

in config.php


ini_set('memory_limit', '-1'); // unlimit memory

 

That seemed to produce an even worse Apache level error :( it was super scary

Link to comment
Share on other sites

AHHHHHHH worked it out. Silly me, think it's actually something i've hit on before in PW, it doesnt like resizing gif's

My code was this:

$imageSmall = $image->width(460);
$imageMedium = $image->width(720);
echo '<div class="slide"><img src="'. $image->url .'" srcset="'. $image->url .' 1440w, '.$imageMedium->url.' 720w, '. $imageSmall->url .' 460w" alt="'.$image->description.'"></div>';

now is this and works like a dream taking out the resizing for gif's:

if($image->ext == "gif" || $image->ext == "GIF"){
  echo '<div class="slide"><img src="'. $image->url .'" alt="'.$image->description.'"></div>';

}else{

  $imageSmall = $image->width(460);
  $imageMedium = $image->width(720);
  echo '<div class="slide"><img src="'. $image->url .'" srcset="'. $image->url .' 1440w, '.$imageMedium->url.' 720w, '. $imageSmall->url .' 460w" alt="'.$image->description.'"></div>';
}

 

Link to comment
Share on other sites

Nice one, maybe for gif's you could just resize front end with an inline style.

Not sure if it's possible but if the file type selected and uploaded was a .gif then use the conditional display in the PW admin to show fields for setting a width / height and just output those params in the style

 

 

Link to comment
Share on other sites

1 hour ago, adrian said:

yep, if you look at the first post error this is the module that was having the issue reported on it.

6 hours ago, benbyf said:

Error: Allowed memory size of 268435456 bytes exhausted (tried to allocate 12288 bytes) (line 190 of /srv/users/serverpilot/apps/hortons/public/site/modules/ImageAnimatedGif/ImageAnimatedGif.module)

 

  • Like 1
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...