Thumbnail Generation PHP Memory Limit NextGEN Gallery
When uploading a set of admittedly large images using NextGEN Gallery to my WordPress site I exceeded my web hosts default memory usage allocation for PHP applications. The error was:
Follow thumbnails could not created. sample.jpg (Error : Exceed Memory limit. Require : 80.65 MByte)
This issue can be resolved by increasing the memory usage allocation at a per-plugin level for PHP applications that require more grunt than others. It’s quick and easy!
- Open an FTP connection to your root WordPress directory
- Open
/wp-content/plugins/nextgen-gallery/lib/gd.thumbnail.inc.phpwith your favourite text editor (e.g. UltraEdit, etc.) - On line #168 un-comment (remove the
//) from before@ini_set('memory_limit', '128M'); - Save and upload changes
- Delete image/s that failed to generate a thumbnail and re-upload using NextGEN Gallery’s standard Upload Images feature
If you find 128MB is too ‘conservative’ this can be increased again to any figure of your liking, I find 128MB appropriate for most commercial and personal usage but if you’re a HD photographer then you’re going to hit this limit very quickly… that’s it!
32 Comments »
Trackbacks
- Travels Through the Vast Expanses of Monotony » My Very First Post and a Problem Solution All At the Same Time!
- Thumbnail Generation PHP Memory Limit in NextGEN Gallery « Sun Grass
- johnjcamilleri.com » Wordpress NextGEN Gallery – Thumbnail Generation PHP Memory Limit
- [ZT]Thumbnail Generation PHP Memory Limit in NextGEN Gallery - Green Vegs Blog
- NextGen Memory Limit « Cludgie's Colossal Waste Of Time!
Leave a comment
The perfect comment is interesting, on-topic and/or highly amusing.







Michael – I have spent over a day trying to solve this issue – messing around with .htaccess, php.ini and memory limits. This simple solution solved the problem immediately. Thankyou so much!
Hey Bob, sweet to hear it helped. How easy would it be to manage PHP script memory limits at a WordPress Administrator level under Settings > Memory, that would be great! Add it to the wish list.
THANK YOU!!! I only last about 2 hours … but THANK YOU … whew … I’ll make sure to bookmark this
Michael – Thanks for this solution. I’m new to the wordpress and web stuff so your simple solution to this problem really was amazing. I probably came across 20 other sites with solutions that just didn’t work for me. I’m not sure about blog etiquette, but I linked to your page from mine so that hopefully others will find you. If you look and I didn’t do it according to standards, let me know and I’ll happily fix it.
Hi Tommy,
Thanks for your kind words, I’m glad it helped. Your site is having a few presentation difficulties of its own…
hi,
I have question, if I have a lot of picture, and running professional blog adding pictures everyday. then am i going to hit this limit , if yes, then how to make it unlimited?
Hi Ajay,
I don’t this issue will affect you as it only occurs at upload time, I do know there is a refresh thumbnail button within NextGEN that if you check all items may cause this issue but it’s unlikely you will encounter this scenario.
Ty sir. That worked like charm. No more thumbnail sizing issues. You are a huge time saver my friend.
Hi Michael,
Just wanted to say thanks for the fix. Your post maybe nearly a year old but it’s just as relevant today as it was then.
Graham.
Hey Graham, it’s an oldie but a goodie! Just make sure you re-apply the fix after auto-updating NextGEN Gallery… plugin function overrides at a WordPress install level is still only a dream.
Thank you so much for sharing! I really appreciate your time and expertise. What an easy solution to a very frustrating problem. Yours was the only advice that was helpful to me…thanks!
Awesome Carolyn, big thanks go out to the original developers for including the source commenting otherwise I’d never have found it.
Hi!
I also just came over this problem. Thanks god, someone posted a link to here at the wp forum. You really solved me a lot time! And only because of 2 slashes…
Thanks a lot for making this public!
Tom
Thank you, you save hours of my live))
by the way, file name is gd.thumbnail.inc.php
Hey Delpher, thanks for the update I’ll do that now. Glad this fix still holds up!
You might have to deactivate the plugin and the reactivate it for this to work.
I’ve had the same problem as described in the post. Unfortunately, this fix didn’t work for me. I’ve also tried altering the memory_limit with .htaccess but then I get an error 500 right away. I asked my host (one.com) and they told me that they don’t allow users to change the memory_limit. To me, that sounds weird, since it’s the first host that I’ve come across that limits their users to just 24M. But hee, at least they’re cheap.
So, I still get an error with pictures over 600px wide and portrait oriented pictures almost always give the fatal error.
I’ve really had it with this! The first couple of hundred (300) photos worked fine. Is there a workaround or a way to do this while using less memory? Or should I consider changing hosting?
Hi Josh,
That 500 error indicates your hosting provider does not allow you to alter php.ini values, contact them directly and get them to increase your memory_limit value.
Thank you for this fix!
Thank you for this easy fix! I only wasted an hour trying to manipulate memory size with .htaccess. But I’ve learned to start searching the web in case of strange error reports. By the way: your name is very Dutch
Was exactly what I was looking for, thanks!
They should make this an option in the plugin itself…
Worked perfectly thanks!
That did the trick! Thanks!
Lovely! Thank you so much for your to-the-point help!
Hi!
I have a question: If I put away the two // then i receive this error:
Parse error: syntax error, unexpected T_STRING in /var/www/web25/web/fotos/wp-content/plugins/nextgen-gallery/lib/gd.thumbnail.inc.php on line 160
What shall I do now?
Thanks!!!! I was killing myself trying to figure this one out!!! This solved it for me right away. Awesome.
Cheers.
Thanks for this post. I’ve been searching for the solution for a while.
Thanks again.