Jump to content

Archived

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

Canman2005

php image rotation question

Recommended Posts

Hi all

I have the following script which takes an image and rotates it,

[code]$filename = 'images/help.jpg';
$degrees = 350;
$source = imagecreatefromjpeg($filename);
imagecolortransparent($source,imagecolorat($source,0,0));  
$rotate = imagerotate($source, $degrees, 0);
$quality=100;
$image = imagejpeg($rotate,"",$quality);[/code]

The problem is that im left with a black background and I cannot seem to turn the background transparent.

Can anyone help?

Thanks in advance

Ed

Share this post


Link to post
Share on other sites
imagerotate()'s third parameter defines the background color:

[!--quoteo--][div class=\'quotetop\']QUOTE[/div][div class=\'quotemain\'][!--quotec--]resource imagerotate ( resource src_im, float angle, int bgd_color )[/quote]
[a href=\"http://www.php.net/imagerotate\" target=\"_blank\"]http://www.php.net/imagerotate[/a]

Share this post


Link to post
Share on other sites

×

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.