I´m trying to rotate a PNG image with PHP. The image rotates but a black background appears.
This is my code:
$image = $_GET['image'];
$degrees = $_GET['degrees'];
header('Content-type: image/png');
$source = imagecreatefrompng($image) ;
$rotate = imagerotate($source, $degrees, 0);
imagesavealpha($rotate, TRUE);
imagepng($rotate);
return rotate;
also add the line
before
Source: Comment in PHP imagerotate