Forum Moderators: coopster

Message Too Old, No Replies

gd lib and resize

         

brnco

7:47 am on Jul 13, 2007 (gmt 0)

10+ Year Member



Hi,

I'm working on a script that resizes images to a certain width-height values.

But the problem is with larger files. I would like to know what's is the max width-height value of picture gd lib is able to resize?

Thanks in advance,

Brnco

joelgreen

10:18 am on Jul 13, 2007 (gmt 0)

10+ Year Member



I think it depends more on memory limit than on max size supported by gd. set memory_limit to -1 to allocate as much as needed.

brnco

11:03 am on Jul 13, 2007 (gmt 0)

10+ Year Member



Yes, but I had one gif picture which was only 200kb but the width was about 4096 pixels. I also tried to set memories and max post size to 30 MB but it didn't solve the problem.

distorto

2:34 pm on Jul 13, 2007 (gmt 0)

10+ Year Member



I have been putting off dealing with a similar problem. I have not been able to isolate where to make necessary changes to allow for larger file sizes. I tried including this in the script that deals with the uploading -

ini_set('memory_limit', '32M');

but I am consistently throwing this error when I try to upload an image file which is 285K

Fatal error: Allowed memory size of 8388608 bytes exhausted (tried to allocate 4800 bytes) in www\image_resize.php on line 24
here's line 24 -
$img_src=imagecreatefromjpeg($srcfile);

also, I have checked the php.ini file and the memory limit is set to 8M by default, which should still allow for my file to be uploaded even without the ini_set...any ideas?

brnco

3:06 pm on Jul 13, 2007 (gmt 0)

10+ Year Member



Maybe it's because of the limitations of the GD library. I tried to look up for the information about maximum allowed resolution but didn't find anything about it.

distorto

3:20 pm on Jul 13, 2007 (gmt 0)

10+ Year Member



I just read an account of someone with an identical problem using ImageMagick. In that post, they resolved the problem by upping the memory_limit. One thing I noticed after posting that code is that my memory_limit is set to 8M even after I changed it manually in php.ini to 32M (and also called that function that sets it to 32M in the uploading script.)
I'm not getting the correct way to up the memory_limit. Hopefully that's the problem.

distorto

3:23 pm on Jul 13, 2007 (gmt 0)

10+ Year Member



got it!
I restarted the server and the photo uploaded fine. I would suggest manually changing the value for memory_limit in the php.ini.

brnco

3:28 pm on Jul 13, 2007 (gmt 0)

10+ Year Member



Lucky you!

Unfortunately I don't have my own server.