imagejpeg or imagecreatetruecolor
Posted: Sun Mar 05, 2006 1:00 pm
Hi all,
for some reason the code below is not writing the image info to the destination file, I have been trying for hours to get it to work, I have check all the vars and they are all being send and all have values, I had it working yesterday, but for some reason I'm missing the spark.
for some reason the code below is not writing the image info to the destination file, I have been trying for hours to get it to work, I have check all the vars and they are all being send and all have values, I had it working yesterday, but for some reason I'm missing the spark.
Code: Select all
function makeThumbnailImage($pathToSourceImage,$pathToThumbImage, $thumbHeight, $thumbWidth)
{
// get image type
$imageType = $this->imageis($pathToSourceImage);
if( $imageType == "jpg"){
// create output file
$src_img=imagecreatefromjpeg($pathToSourceImage);
// calutlate the size of out put file, maintaining aspect ratio
$thumbXY = $this->calcNewSize($imageWidth,$imageHeight,$thumbWidth,$thumbHeight);
$dst_img = @imagecreatetruecolor($thumbXY[0],$thumbXY[1]) or die("Unable to create thumbnail image stream!!<br>Image Name: $fileName");
// write image to Thumb file
imagejpeg($dst_img,$pathToThumbImage);
// remove image from ram
imagedestroy($dst_img);
imagedestroy($src_img);
}
}