Karl Blessing
Programmer
trying to write a function that will rotate an image. I have the GD2 extension loaded, I have PHP 4.3.2 ( I had to upgrade as its said imagerotate() doesnt work on lower than 4.3.0 )
this is the function with some debug echos in it.
The last echo I see is "Copy Created", I Cant get any code past the imagerotate function.
Karl Blessing
PHP/MySQL Developer
Envynews.com
this is the function with some debug echos in it.
Code:
function rotatePix($sourcefile, $targetfile, $degrees)
{
echo "sourcefile : ".$sourcefile."<BR>targetfile: ".$targetfile."<BR>degrees: ".$degrees."°<BR>";
$img_size = getImageSize($sourcefile);
$x = $img_size[0];
$y = $img_size[1];
echo "Image Size Obtained.<BR>";
if ($x > $y)
{
$newd = $x;
}
else
{
$newd = $y;
}
$src_img = ImageCreateFromJPEG($sourcefile);
echo "Source created.<BR>";
$dst_img = ImageCreateTrueColor($newd,$newd);
echo "Destination Prepared.<BR>";
$final_img = ImageCreateTrueColor($y,$x);
ImageCopyResampled($dst_img,$src_img,0,0,0,0,$x,$y,$x,$y);
echo "Copy Created.<BR>";
$rotated_img = imagerotate($dst_img, $degrees,0);
echo "Image Rotated.<BR>";
ImageCopyResampled($final_img,$rotated_img,0,0,0,0,$y,$x,$y,$x);
echo "Rotated Image Copied to Destination.<BR>";
ImageJPEG($final_img, targetfile);
}
The last echo I see is "Copy Created", I Cant get any code past the imagerotate function.
Karl Blessing
PHP/MySQL Developer
Envynews.com