By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
455,716 Members | 1,317 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 455,716 IT Pros & Developers. It's quick & easy.

Problem with "imagerotate"

P: n/a
Does the "imagerotate" function in PHP5 work correctly or am I doing
something wrong?

I'm using the code shown below to generate a simple rectangle and then
to rotate it a specific number of degrees. The actual rotation itself
seems to happen OK but the background color appears correctly only if
the rotation is between 1 and 45 degrees; any other value and the
background is black. And, in neither case does the
"imagecolortransparent" work (I want the background to be
transparent).
$myImg = imagecreate($somelength,$somewidth);
$myBG = imagecolorallocate($myImg,85,255,255);
$RectColor = imagecolorallocate($myImg,200,200,200);
$myBlack = imagecolorallocate($myImg, 0, 0, 0);
imagefilledrectangle($myImg,1,1,($somelength-2),($somewidth-2),
$RectColor);
imagerectangle($myImg,0,0,($somelength-1),($somewidth-1), $myBlack);

$myImage = imagerotate($myImg, $someangle, $myBG);

imagedestroy($myImg);

imagecolortransparent($myImage,$myBG);

imagepng($myImage,"gMyRect.png");
imagedestroy($myImage);

Jul 17 '05 #1
Share this question for a faster answer!
Share on Google+

This discussion thread is closed

Replies have been disabled for this discussion.