note 15048 added to function.imagecolortransparent.php
| From: | olivier at moostik dot net | Date: | Sat, 25 Aug 2001 20:10:50 +0000 |
| Subject: | note 15048 added to function.imagecolortransparent.php | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-17136@lists.php.net to get a copy of this message | ||
If u want to get the index of existing transparent color, u can use GetImageTransparent function.
function GetImageTransparent ($path)
{
/*
Get the index of the transparent color of a GIF image
int getimagetransparent (string filename);
The GetImageTransparent function will determine the transparent color index of a Gif89a image
Returns false on error.
Note: This function does not require the GD image library.
*/
$fp=@fopen($path,'r');
if(!$fp || @fgets($fp,7)!="GIF89a")
{
@fclose($fp);
return FALSE;
}
fseek($fp,10);
fseek($fp,(3*pow(2,bindec(substr(decbin(ord(fgets($fp,2))),5,7))+1))+13);
if(dechex(ord(fgets($fp,2))).dechex(ord(fgets($fp,2)))=='21f9')
{
fgets($fp,5);
$temp =fgets($fp,2);
fclose($fp);
return ord($temp);
}
return false;
}
send me any suggestion else.
http://www.php.net/manual/en/function.imagecolortransparent.php