Jump to content

I need help rotating a .gif image with a transparent background in php


K.out

Recommended Posts

Hello,

 

  I need help rotating a .gif with a transparent background in php.  I have php 5.2.8 and GD version bundled (2.0.34).  Below is that code that I currently have I developed it from a variety of sources.  The background appears to be black when I run it by itself.  However, I tried to add this code to the file that I intend to use it in and I prints a bunch of stuff that I don't understand.  Once, I have the code to rotate the image 180 degrees and keep the transparent background.  I would like to use it in a .php file where I will insert the new image in an HTML table.

 

<?php
header( "Expires: Mon, 26 Jul 1997 05:00:00 GMT" );
header( "Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT" );
header( "Cache-Control: no-store, no-cache, must-revalidate" );
header( "Cache-Control: post-check=0, pre-check=0", false );
header( "Pragma: no-cache" );
$imagepath="blkpc6.gif";
$degrees=180;
$image=imagecreatefromgif($imagepath);
imagealphablending($image, false);
imagesavealpha($image,true);
$transparent = imagecolorallocatealpha($image, 255, 255, 255, 127);
$rotate = imagerotate($image, $degrees, $transparent);
header('Content-Type: image/gif');
imagegif($rotate);
imagedestroy($rotate);
imagedestroy($image);
?>

 

Please, help me solve this problem.  I have tried to solve it to no end the last couple of days with no luck.  Thank you for your help.

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.