Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#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

#2 2011-11-16 11:37:08

Gocom
Developer Emeritus
From: Helsinki, Finland
Registered: 2006-07-14
Posts: 4,533
Website

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

#3 2011-11-16 15:57:19

maruchan
Member
From: Ukiah, California
Registered: 2010-06-12
Posts: 595
Website

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

#5 2011-11-16 23:43:24

Gocom
Developer Emeritus
From: Helsinki, Finland
Registered: 2006-07-14
Posts: 4,533
Website

Re: large-dimension images fail to thumbnail

evan wrote:

Thanks, but like I said, I already maxed out, at 90mb.

Unless the error message is taken before changing the configuration to 90 MB, 33554432 bytes translates to 32 MB.

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

#8 2011-11-17 07:41:17

Gocom
Developer Emeritus
From: Helsinki, Finland
Registered: 2006-07-14
Posts: 4,533
Website

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

#9 2011-12-05 11:32:14

wet
Developer Emeritus
From: Schoerfling, Austria
Registered: 2005-06-06
Posts: 3,330
Website Mastodon

Re: large-dimension images fail to thumbnail

Thanks for the report. Change set 3697 takes care of this issue.

Offline

Board footer

Powered by FluxBB