Transparent Images
Posted: Thu Sep 14, 2006 3:37 pm
feyd | Please use
I tried placing an "imagefilledrectangle" in the foreground image, with its color allocated to transparent, but that proved unsuccessful. Any help would be appreciated.
feyd | Please use
Code: Select all
,Code: Select all
and [syntax="..."] tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read: [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color]
I am having trouble placing a transparent image over top of another image using GD. Currently I have a background image, and I am attempting to place a smaller, transparent gif on top of it. The problem is that when the foreground image is enabled, I get all black around everything but the transparent image, yet I can still see through the transparency to the background images in the areas where the smaller image is. (if that makes any sense)
Here is a snippet of the code:Code: Select all
if (is_file($bgimage)){
$suffix = array_pop(split("\.", $bgimage));
$func = "imagecreatefrom" . $filetypes[$suffix];
$im2 = $func($bgimage);
imagecopyresized($im, $im2, 0, 0, 0, 0, $image_width, $image_height, $image_width, $image_height);
}
if (is_file($fgimage)){
$suffix2 = array_pop(split("\.", $fgimage));
$func2 = "imagecreatefrom" . $filetypes[$suffix2];
$im3 = $func2($fgimage);
imagecopyresized($im, $im3, 0, 0, -($bg_x), -($bg_y), $image_width, $image_height, $image_width, $image_height);
}feyd | Please use
Code: Select all
,Code: Select all
and [syntax="..."] tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read: [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color]