Axiss
09-04-2005, 12:12 PM
Ok, here's my problem. I have a .tga file, which I manually converted to a .png in PSP. I maintained the alpha channel transparency of the .tga into the .png file as its transparency. Then I had a file the CG functions could process to extract the 40x40 icons out of this composite file.
Problem is the extracted Icons do not show as transparent in IE, but they work just fine in both Firefox and Opera. So, I figure ok let's try this with GIF format. Still, no dice in IE and there's no transparency in Firefox or Opera now. I must have the transparency in IE. So, below is the code I'm using. Does anyone know what the problem is? I've looked over google and thru php.net and not been able to turn up a solution. Any help is appreciated.
Note: for GIF I just changed the places it says PNG to GIF. The Transparency color settings were added in as part of it too.
$image = imageCreateFromPNG("Icons.png");
$nImage = 1;
for($nI=0; $nI <=5; $nI++)
{
for($nY=0;$nY <=5; $nY++)
{
$image_p = imageCreateTrueColor(40, 40);
$trans = imageColorResolve($image_p, 0, 0, 0);
imageColorTransparent($image_p, $trans);
imageCopyResampled($image_p, $image, 0, 0 , 40 * $nY, 40 * $nI, 40, 40, 40, 40);
imagePNG($image_p, "icon" . $nImage . ".png");
$nImage++;
}
}
Problem is the extracted Icons do not show as transparent in IE, but they work just fine in both Firefox and Opera. So, I figure ok let's try this with GIF format. Still, no dice in IE and there's no transparency in Firefox or Opera now. I must have the transparency in IE. So, below is the code I'm using. Does anyone know what the problem is? I've looked over google and thru php.net and not been able to turn up a solution. Any help is appreciated.
Note: for GIF I just changed the places it says PNG to GIF. The Transparency color settings were added in as part of it too.
$image = imageCreateFromPNG("Icons.png");
$nImage = 1;
for($nI=0; $nI <=5; $nI++)
{
for($nY=0;$nY <=5; $nY++)
{
$image_p = imageCreateTrueColor(40, 40);
$trans = imageColorResolve($image_p, 0, 0, 0);
imageColorTransparent($image_p, $trans);
imageCopyResampled($image_p, $image, 0, 0 , 40 * $nY, 40 * $nI, 40, 40, 40, 40);
imagePNG($image_p, "icon" . $nImage . ".png");
$nImage++;
}
}
