So I'm new to PHP GD, I cant understand why the PNG image will not go transparent, it's just showing a white background.
Could anyone help me out with this?
<?php
$hour = date('H');
if ($hour > 4 && $hour < 12) {
$image = "day.png";
} elseif ($hour > 11 && $hour < 19) {
$image = "day.png";
} else {
$image = "night.png";
}
$image = imagecreatefrompng( "$image" );
if (!$image) { /* See if it failed */
header("(anti-spam-(anti-spam-content-type:)) $extList");
$im = imagecreatetruecolor (150, 30); /* Create a blank image */
$bgc = imagecolorallocate ($im, 255, 255, 200);
$tc = imagecolorallocate ($im, 0, 0, 0);
imagefilledrectangle ($im, 0, 0, 150, 30, $bgc);
/* Output an errmsg */
imagestring ($im, 1, 5, 5, "Error loading Image", $tc);
imagepng($im);
imagedestroy($im);
die();
}
header("(anti-spam-(anti-spam-content-type:)) image/png");
imagepng($image);
imagedestroy($image);
?>
Thanks, Sam