Jump to content

php image rotation question


Canman2005

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
Link to comment
https://forums.phpfreaks.com/topic/11826-php-image-rotation-question/
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]

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.