Jump to content

GD+Rotation+Transparency issues


FireLizzard

Recommended Posts

I'm using GD to rotate images, but it is screwing up my transparency. Here is my page. Here is the php for get.php:

<?php //echo "<pre>" . print_r($_SERVER, true) . "</pre>";

function root_url_path() {
try {
	throw new Exception();
} catch (Exception $e) {
	preg_match("/exception 'Exception' in ([^:]*):[0-9]*/", $e, $matches);
	preg_match("/([^\.]*)".str_replace("/", "\\/", $_SERVER['PHP_SELF'])."/", $matches[1], $matches);
	return $matches[1];
}
}

$dir		= root_url_path();
$section	= $_REQUEST['sec'];
$region		= $_REQUEST['reg'];
$rotation	= $_REQUEST['deg'];
$loadfile	= "$dir/layout/$section/$region.png";

header("Content-type: image/png");

$img = imagecreatefrompng($loadfile);
$img = imagerotate($img, $rotation, 0, 0);

imagepng($img);

?>

 

Can anyone tell me how to rotate the images without losing transparency?

Link to comment
https://forums.phpfreaks.com/topic/199211-gdrotationtransparency-issues/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.