Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#13 2007-03-27 13:14:41

ruud
Developer Emeritus
From: a galaxy far far away
Registered: 2006-06-04
Posts: 5,068
Website

Re: 1,2MB image upload error

What is the width and height of that image in pixels?
Suppose the image is 2048×1526, 24-bits. That’s 2048×1526×3 = 9437184 bytes (even if it’s much smaller as a JPEG file)
With bigger images and perhaps some auto-thumbnailing going on, combine that with the memory usage of TXP itself and you may very well exceed the memory limit.

Offline

#14 2007-03-27 13:30:51

Gallex
Member
Registered: 2006-10-08
Posts: 1,292

Re: 1,2MB image upload error

ruud wrote:

What is the width and height of that image in pixels?

2000×2805, 24-bits

Suppose the image is 2048×1526, 24-bits. That’s 2048×1526×3 = 9437184 bytes (even if it’s much smaller as a JPEG file)
With bigger images and perhaps some auto-thumbnailing going on, combine that with the memory usage of TXP itself and you may very well exceed the memory limit.

Offline

#15 2007-03-29 01:12:53

zem
Developer Emeritus
From: Melbourne, Australia
Registered: 2004-04-08
Posts: 2,579

Re: 1,2MB image upload error

At an absolute minimum, that image requires about 16mb of memory, not counting overheads. If PHP’s image processing files make a copy of the image in memory (something we have no control over), you can at least double that. Your memory limit setting is at 24mb. Textpattern itself typically uses 2-4mb.

I checked in a tentative change that attempts to increase the memory limit to 32mb when resizing images (svn r2263). It needs testing.

Last edited by zem (2007-03-29 01:14:13)


Alex

Offline

#16 2007-03-29 05:59:32

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

Re: 1,2MB image upload error

zem wrote:

I checked in a tentative change that attempts to increase the memory limit to 32mb when resizing images (svn r2263). It needs testing.

How much EXTRA_MEMORY is MORE_MEMORY?

Offline

#17 2007-03-29 07:00:49

ruud
Developer Emeritus
From: a galaxy far far away
Registered: 2006-06-04
Posts: 5,068
Website

Re: 1,2MB image upload error

Looks like a hard-coded limit. Does this mean that MORE_MEMORY is less memory if the limit was set higher in php.ini?
Even if such an approach works, should scripts bypass a memory limit set by the webhost?

Another way to solve this may be to predict how much memory is needed based on the image size and skip thumbnailing if it gets too close to the memory limit. In those cases the user can either upload thumbs manually or have the limit increased by the webhost. Because, no matter how high you set MORE_MEMORY, people will upload even bigger images and still run into the memory limitations.

Last edited by ruud (2007-03-29 08:06:03)

Offline

#18 2007-03-29 07:04:24

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

Re: 1,2MB image upload error

ruud wrote:

Looks like a hard-coded limit.

Hmm, for me it looks like a typo, but as I’m more experienced in stronger typed languages this might be another PHP specifity I just don’t know of yet.

Offline

#19 2007-03-29 07:07:58

ruud
Developer Emeritus
From: a galaxy far far away
Registered: 2006-06-04
Posts: 5,068
Website

Re: 1,2MB image upload error

Heh, I hadn’t even noticed that it said ‘extra’ in the define :)

Offline

#20 2007-03-30 12:37:05

Mary
Sock Enthusiast
Registered: 2004-06-27
Posts: 6,236

Re: 1,2MB image upload error

I would say yes, it’s a typo.

Offline

Board footer

Powered by FluxBB