Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

GD Library size limit

Status
Not open for further replies.

audiopro

Programmer
Apr 1, 2004
3,165
GB
Is there a size limit for GD library?
This code works fine with 800px x 600px images but fails to convert 3168px x 4752px.
The images are being converted to 150px x 150px.
Code:
<?php
	$img_name=$_GET['imnam'];
	$new_width=$_GET['maxwid'];
	$new_height=$_GET['maxhi'];
	$img_name="../httpdocs/uppydoc/"."$img_name";

	$size=GetImageSize($img_name);

	$bwimage = ImageCreateFromJPEG($img_name);

	$thumb = ImageCreateTrueColor($new_width,$new_height);

	ImageCopyResampled($thumb, $bwimage, 0,0,0,0,$new_width,$new_height,$size[0],$size[1]);
	ImageJPEG($thumb);

	ImageDestroy($thumb);
	ImageDestroy($bwimage);
?>

In this instance, the proprtions do not matter as they are only a visual confirmation transferred files.

Keith
 
Are you sure its the library and not the script timing out? Or a server issue?

Large images would take much more resources to convert, as well as a longer time, which may be causing the script to time out.

Have tried altering timeout setting in the PHP.ini?

Maybe monitor the resource usage when the script is running on the larger images just to see what's going on?

----------------------------------
Phil AKA Vacunita
----------------------------------
Ignorance is not necessarily Bliss, case in point:
Unknown has caused an Unknown Error on Unknown and must be shutdown to prevent damage to Unknown.

Behind the Web, Tips and Tricks for Web Development.
 
It's an out-of-memory issue. I don't know if there's a formula, but it seems to happen with images that are large or high-resolution. Changing the memory in php.ini might work, up to a point. After trying 512MB I gave up and use ImageMagick now.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top