Hi experts,
I need to take sequence of images as input from a folder and after resizing the resized image should store on output folder. I write a code. But in my code after resizing image, out put folder only show black image.
To debug this code pls create input & output folder and put some gif image on input folder and see the output on output folder.
Pls HELP!
<?php
$dir=opendir("input/");
$i=0;
while($imgfile=readdir($dir))
{
if ($imgfile != "." && $imgfile!="..")
{
$imgarray[$i]=$imgfile;
$newwidth=240; //new width
$newheight=320; //new height
$uploadedfile = $imgarray[$i];
$src = imagecreatefromgif($uploadedfile);
list($width,$height)=getimagesize($uploadedfile);
$tmp=imagecreatetruecolor($newwidth,$newheight);
imagecopyresampled($tmp,$src,0,0,0,0,$newwidth,$newheight,$width,$height);
$filename = "output/".$imgarray[$i];
imagegif($tmp,$filename,100);
imagedestroy($src);
imagedestroy($tmp);
$i++;
}
}
closedir($dir);
?>