CaptainB
03-27-2009, 04:57 PM
Hi,
I've got this code generating an image with some specified text on top of a specified background. The background is a .png image whith a transparent background. However, the php-generated image does not have the transparent background as the original image had - it's filled with black instead.
The second picture is the original while the first is a screenshot of the php result:
<?php
header("Content-type: image/png");
$image = imagecreatefrompng("seddel.png");
//imagecolorallocate($image, R, G, B) in HEX values
$font_black = imagecolorallocate($image, 2, 1, 8);
$string = "your text 1";
//($image, fontsize, rightindent, downindent, data, txtcolour)
imagestring($image, 3, 7, 30, $string, $font_black);
imagepng($image);
imagedestroy($image);
?>
Does anybody know why this is caused and how to fix it?
I've got this code generating an image with some specified text on top of a specified background. The background is a .png image whith a transparent background. However, the php-generated image does not have the transparent background as the original image had - it's filled with black instead.
The second picture is the original while the first is a screenshot of the php result:
<?php
header("Content-type: image/png");
$image = imagecreatefrompng("seddel.png");
//imagecolorallocate($image, R, G, B) in HEX values
$font_black = imagecolorallocate($image, 2, 1, 8);
$string = "your text 1";
//($image, fontsize, rightindent, downindent, data, txtcolour)
imagestring($image, 3, 7, 30, $string, $font_black);
imagepng($image);
imagedestroy($image);
?>
Does anybody know why this is caused and how to fix it?