View Full Version : Resize large image

Satal Keto
11-19-2007, 05:48 PM
Hello I am trying to get some code which will resize images which are uploaded to my website using a form.
The code I am using to resize the images atm is

function createThumbnail($imageDirectory, $imageName, $thumbDirectory, $thumbHeight)
$srcImg = imagecreatefromjpeg("$imageDirectory/$imageName");
$origWidth = imagesx($srcImg);
$origHeight = imagesy($srcImg);

$ratio = $origHeight / $thumbHeight;
$thumbWidth = $origWidth / $ratio;
imagejpeg($dst_img,$thumbDirectory . "/" . $imageName);
The problem is when ever I try to run this code it is saying...

Fatal error: Allowed memory size of 33554432 bytes exhausted (tried to allocate 3264 bytes) in K:\WOS Stuff\www\sb\adminPhotos.php on line 5where line 5 is
$srcImg = imagecreatefromjpeg("$imageDirectory/$imageName");
I was wondering whether anyone had any idea's of some how that I would be able to resize the images without causing this error?

11-19-2007, 05:59 PM
You need to change the value for: memory_limit

This can be found in your php.ini configuration file on the server. (Default: 32M)