0

hi all
i problem rotate image (png)
code :

$myimage=imagecreatefromjpeg('test.jpg');
$mypng=imagecreatefrompng('opera.png');
$sizepng= getimagesize('opera.png');

$jpgwidth=imagesx($myimage);
$jpghieght=imagesy($myimage);
$pngwidth=imagesx($mypng);
$pnghieght=imagesy($mypng);
$pngwidth1=$sizepng[0] / 10;
$pnghieght1=$sizepng[1] / 10;

imagerotate(mypng,50,1);
imagecopyresized($myimage,$mypng,0,0,0,0,$pngwidth1,$pnghieght1,$sizepng[0],$sizepng[1]);
header("Contents-type: image/jpeg");
imagejpeg($myimage);
imagedestroy($myimage);
imagedestroy ($mypng);
2
Contributors
1
Reply
2
Views
8 Years
Discussion Span
Last Post by Rhyan
0

....

imagerotate(mypng,50,1);
imagecopyresized($myimage,$mypng,0,0,0,0,$pngwidth1,$pnghieght1,$sizepng[0],$sizepng[1]);
header("Contents-type: image/jpeg");
imagejpeg($myimage);
imagedestroy($myimage);
imagedestroy ($mypng);

You are trying to create a JPG from PNG. I don't think that GD allows this. Therefore you should use createimagefrompng() and imagecopyresampled(). Also, header(content....) should be PNG, not JPG.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.