Textpattern CMS support forum
You are not logged in. Register | Login | Help
- Topics: Active | Unanswered
#1 2011-11-16 06:38:30
- evan
- Member
- Registered: 2010-01-31
- Posts: 16
large-dimension images fail to thumbnail
Hi all,
I’m trying to upload larger dimension images (greater than 3000 × 2000px), and TXP runs out of memory when it tries to create a thumbnail, like this:
Fatal error: Allowed memory size of 33554432 bytes exhausted (tried to allocate 13056 bytes) in /textpattern/lib/class.thumb.php on line 163
My PHP.ini memory_limit is already maxed. What else can I do to make this work? I don’t really want to create my own thumbnails for everything. If a plugin exists to do this, please let me know.
Thanks!
-evan
Last edited by evan (2011-11-16 06:39:13)
Offline
Re: large-dimension images fail to thumbnail
evan wrote:
My PHP.ini memory_limit is already maxed. What else can I do to make this work?
Not something else, but Increase PHP’s memory limit. Textpattern uses GD for resizing images, and bigger images will take loads of memory. For the image sizes you are dealing with, you may need to up the memory limit to 80-100 MB or more.
Writing a new thumbnail class for Textpattern using ImageMagick (which would require ImageMagick) could reduce memory usage and make thumbnail creation more efficient. Unfortunately I’m not aware of any plugin that extends or changes resizing produce to be any efficient.
Offline
Re: large-dimension images fail to thumbnail
Here’s a PHP image resize script that uses ImageMagick. I use one that uses GD with Textpattern and it saves a lot of work. :-)
Offline
#4 2011-11-16 23:12:46
- evan
- Member
- Registered: 2010-01-31
- Posts: 16
Re: large-dimension images fail to thumbnail
Gocom wrote: Not something else, but Increase PHP’s memory limit. Textpattern uses GD for resizing images, and bigger images will take loads of memory. For the image sizes you are dealing with, you may need to up the memory limit to 80-100 MB or more.
Thanks, but like I said, I already maxed out, at 90mb.
Gocom wrote: Writing a new thumbnail class for Textpattern using ImageMagick (which would require ImageMagick) could reduce memory usage and make thumbnail creation more efficient. Unfortunately I’m not aware of any plugin that extends or changes resizing produce to be any efficient.
Not something I really want to do!
I’ll try out that script…it’s really too bad the built-in thumbnailing isn’t working properly. Hopefully it gets addressed in future TXP versions. Thanks for the responses!
Offline
Offline
#6 2011-11-17 00:50:33
- evan
- Member
- Registered: 2010-01-31
- Posts: 16
Re: large-dimension images fail to thumbnail
I’m not sure what’s happening with the error message, but php_info tells me I have it set to 128mb. Am I missing something? Do I need to declare a custom php.ini somewhere in TXP?
Offline
#7 2011-11-17 00:56:06
- evan
- Member
- Registered: 2010-01-31
- Posts: 16
Re: large-dimension images fail to thumbnail
Well! Just figured it out.
Line 157 of class.thumb.php checks if the image is larger than 1024px, and tries to allocate more memory with ini_set to EXTRA_MEMORY (defined in constants.php as 32mb). Change the value or comment it out, and it works fine.
Last edited by evan (2011-11-17 01:31:51)
Offline
Re: large-dimension images fail to thumbnail
evan wrote:
Line 157 of class.thumb.php checks if the image is larger than 1024px, and tries to allocate more memory with ini_set to EXTRA_MEMORY (defined in constants.php as 32mb). Change the value or comment it out, and it works fine.
You could (or should, I suppose) put define('EXTRA_MEMORY', '128M');
to config.php
. Makes updating Textpattern easier as you don’t have to re-modify (or remember to) constants.php file again.
Offline
Re: large-dimension images fail to thumbnail
Thanks for the report. Change set 3697 takes care of this issue.
Offline