Jump to content
benbyf

Allowed memory size of ImageAnimatedGif

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

Share this post


Link to post
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

 

 

Share this post


Link to post
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

Share this post


Link to post
Share on other sites

If you need a quick solution try

in config.php

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

 

Share this post


Link to post
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

Share this post


Link to post
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>';
}

 

Share this post


Link to post
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

 

 

Share this post


Link to post
Share on other sites

True, but it was mainly to get faster page speeds so the resizing was needed. however it doesnt seem to work for some reason :( (gif's are bloaty)

Share this post


Link to post
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

Share this post


Link to post
Share on other sites
26 minutes ago, benbyf said:

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

 

Sorry :)

  • Like 1

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


  • Recently Browsing   0 members

    No registered users viewing this page.

  • Similar Content

    • By j00st
      Hi everyone! 
       
      So I've been going over all the Animated GIF topics before posting this, but unfortunately I'm none the wiser at the moment.
      I'm super happy Horst's module has been included into the Core install, but as you might guess...I'm still having issues with my Animated GIFs 😞
      CMS & File checklist:
      Double-checked if the module is installed = YES
      Correct upload of GIF = YES
      Testing GIF has 72dpi & is 1000x1000px & 563kb = Shouldn't cause any problem, right?
      Uploaded GIF still shows animation in backend = YES
      ProcessWire is up to date = 3.0.108

      Front-end tests:
      Tried the following code, to see if it had to do with the way I'm resizing, but both with no results.
      <?php echo $img->width(720)->url?> <?php echo $img->size(720, 0)->url?> Here's the big catch though: 
      If I just echo the $img->url it will show the GIF...so it has to do with the resizing...but this is where I got stranded...
      UPDATE:
      Just in case, I also added the PHP & MySQL versions I'm running. Server's online not local.
      PHP 5.6.32 (in the overview) ----> But it's in fact, when going to the PHP admin, it's running PHP 7.0. Any chance this is what's causing the issue?
      MySQL 5.6.23-78.1
      Any tips?
       
       
    • By jploch
      Hi!
      I have a problem with uploading animated GIFs again.
      The upload starts, but never finishes and just loads forever.
      Iam running PW 3.0.62 and have the Image Animated GIF Module installed.

      I also increased the memory limit in the htaccess file in PW root directory like this:
      <IfModule mod_php5.c>
      php_value memory_limit 256
      php_value upload_max_filesize 64M
      php_value post_max_size 64M
      php_value max_execution_time 300
      php_value max_input_time 1000
      </IfModule> 
      I had this problem before, but was able to fix it with the Animated GIF Module and the modification of the htaccess file.
      So maybe this is related to the provider (strato).
      Here is the error I get, when uploading the GIF (1.1 MB filesize)
      Warning: preg_match_all() expects at least 3 parameters, 2 given in /mnt/web216/a2/50/51925650/htdocs/processwire/wire/core/PWGIF.php on line 252 Warning: preg_match_all() expects at least 3 parameters, 2 given in /mnt/web216/a2/50/51925650/htdocs/processwire/site/assets/cache/FileCompiler/site/modules/ImageAnimatedGif/ImageAnimatedGif.module on line 285 Warning: preg_match_all() expects at least 3 parameters, 2 given in /mnt/web216/a2/50/51925650/htdocs/processwire/wire/core/PWGIF.php on line 252 Warning: preg_match_all() expects at least 3 parameters, 2 given in /mnt/web216/a2/50/51925650/htdocs/processwire/wire/core/PWGIF.php on line 252 Warning: preg_match_all() expects at least 3 parameters, 2 given in /mnt/web216/a2/50/51925650/htdocs/processwire/site/assets/cache/FileCompiler/site/modules/ImageAnimatedGif/ImageAnimatedGif.module on line 285 Warning: preg_match_all() expects at least 3 parameters, 2 given in /mnt/web216/a2/50/51925650/htdocs/processwire/wire/core/PWGIF.php on line 252 [{"error":false,"message":"Added file: test.gif","file":"\/processwire\/site\/assets\/files\/1098\/test.gif","size":101734,"markup":"<li id='file_daf280af792fd5b906511363ae2bc39d' class='ImageOuter gridImage ui-widget'><div class='gridImage__tooltip'><table><tr><th>Dimensions<\/th><td>500x333<\/td><\/tr><tr><th>Filesize<\/th><td>99&nbsp;kB<\/td><\/tr><tr><th>Variations<\/th><td>0<\/td><\/tr><\/table><\/div>\n\t\t\t<div class='gridImage__overflow'>\n\t\t\t\t<img src=\"\/processwire\/site\/assets\/files\/1098\/test.0x260.gif?nc=1509109293\" alt=\"\" data-w=\"500\" data-h=\"333\" data-original=\"\/processwire\/site\/assets\/files\/1098\/test.gif?nc=1509109293\" \/>\n\t\t\t<\/div>\n\t\t\t\n\t\t\t\t<div class='gridImage__hover'>\n\t\t\t\t\t<div class='gridImage__inner'>\n\t\t\t\t\t\t<label for='' class='gridImage__trash'>\n\t\t\t\t\t\t\t<input class='gridImage__deletebox' type='checkbox' name='delete_thumbnail_daf280af792fd5b906511363ae2bc39d' value='1' title='Delete' \/>\n\t\t\t\t\t\t\t<span class='fa fa-trash-o'><\/span>\n\t\t\t\t\t\t<\/label>\n\t\t\t\t\t\t<a class='gridImage__edit'>\n\t\t\t\t\t\t\t<span>Edit<\/span>\n\t\t\t\t\t\t<\/a>\n\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\n\t\t\t\t<div class='ImageData'>\n\t\t\t\t\t<h2 class='InputfieldImageEdit__name'><span contenteditable='true'>test<\/span>.gif<\/h2>\n\t\t\t\t\t<span class='InputfieldImageEdit__info'>99&nbsp;kB, 500&times;333 <\/span>\n\t\t\t\t\t<div class='InputfieldImageEdit__errors'><\/div>\n\t\t\t\t\t<div class='InputfieldImageEdit__buttons'><small><button type='button' data-href='\/processwire\/admin\/page\/image\/edit\/?id=1098&file=1098,test.gif&rte=0&field=thumbnail' class='InputfieldImageButtonCrop ui-button ui-corner-all ui-state-default pw-modal-large pw-modal' data-buttons='#non_rte_dialog_buttons button' data-autoclose='1' data-close='#non_rte_cancel'><span class='ui-button-text'><span class='fa fa-crop'><\/span> Crop<\/span><\/button><button type='button' data-href='\/processwire\/admin\/page\/image\/variations\/?id=1098&file=test.gif&modal=1&varcnt=varcnt_thumbnail_daf280af792fd5b906511363ae2bc39d' class='ui-button ui-corner-all ui-state-default pw-modal-large pw-modal' data-buttons='button'><span class='ui-button-text'><span class='fa fa-files-o'><\/span> Variations <span class='ui-priority-secondary'>(0)<\/span><\/span><\/button><\/small><\/div>\n\t\t\t\t\t<div class='InputfieldImageEdit__core'><div class='InputfieldFileDescription'><label for='description_thumbnail_daf280af792fd5b906511363ae2bc39d' class='detail'>Description<\/label><input type='text' name='description_thumbnail_daf280af792fd5b906511363ae2bc39d' id='description_thumbnail_daf280af792fd5b906511363ae2bc39d' value='' \/><\/div><\/div>\n\t\t\t\t\t<div class='InputfieldImageEdit__additional'><\/div>\n\t\t\t\t\t<input class='InputfieldFileSort' type='text' name='sort_thumbnail_daf280af792fd5b906511363ae2bc39d' value='1' \/>\n\t\t\t\t\t<input class='InputfieldFileReplace' type='hidden' name='replace_thumbnail_daf280af792fd5b906511363ae2bc39d' \/>\n\t\t\t\t\t<input class='InputfieldFileRename' type='hidden' name='rename_thumbnail_daf280af792fd5b906511363ae2bc39d' \/>\n\t\t\t\t<\/div>\n\t\t\t<\/li>","replace":true,"overwrite":0}]  
    • By sirhc
      Hi,
      I have a big image in my image field and want to resize it to 2280px before showing it to the user.
      Most images are fine and showing as expected, but with one I have the following error;

      Error: Out of memory (allocated 159383552) (tried to allocate 12288 bytes) (line 243 of /htdocs/process/wire/core/ImageSizerEngineGD.php) 

      Why is this with one image and not with the other ones, and how to solve this?
      Greetz.
    • By benbyf
      Hi, this has probably been asked before but after a google couldnt find the anwser.
      When resizing an image using the PW function:
      image->size() a GIF's animation is not retained (simple a GIF still), is there any way of creating computed sizes without loosing the GIF animation?
×
×
  • Create New...