Hi
The following code works on my computer but when i load it onto the server it works until it gets to imagecreatefromjpeg line then the program stops , the folders are all 0777
What i am trying to do is to scan through a folder and resize all images in that folder and move the resized images to a different folder
Any Idea what the problem could be
<?php
$dir = 'test';
$files2 = scandir($dir, 1);
$count=count($files2)-2;
for($i=0; $i<$count;$i++)
{
$uploadedfile ="test/".$files2[$i];
$resizedfile="pic/".$files2[$i];
list($width,$height)=getimagesize($uploadedfile);
$newwidth=330;
$newheight=($height/$width)*280;
if(($height/$width)<1.3){$newheight=($height/$width)*340;}
$tmp=imagecreatetruecolor($newwidth,$newheight);
$src =imagecreatefromjpeg($uploadedfile);
imagecopyresampled($tmp,$src,0,0,0,0,$newwidth,$newheight,$width,$height);
imagejpeg($tmp,$resizedfile,90);
}
?>
Problem With imagecreatefromjpeg
Moderator: General Moderators
Re: Problem With imagecreatefromjpeg
is the gd library available on the machine in question?
Re: Problem With imagecreatefromjpeg
I was getting the following error ,
Allowed memory size of 52428800 bytes exhausted (tried to allocate 12800 bytes) in createimage.php on line 48
i increase the memory limit from 24m to 50 m but still the same error , then increased it to 100m and it worked .
Why does imagecreatefromjpeg use that amount of memory just for an 240K image
Thanks for the help
Allowed memory size of 52428800 bytes exhausted (tried to allocate 12800 bytes) in createimage.php on line 48
i increase the memory limit from 24m to 50 m but still the same error , then increased it to 100m and it worked .
Why does imagecreatefromjpeg use that amount of memory just for an 240K image
Thanks for the help