Reputation: 3786
In the images folder i have a notfound.php file with
<?php
header('Content-type: image/png');
$im = imagecreatefrompng('simnotfound.png');
imagepng($im);
imagedestroy($im);
?>
The image is a 256 by 256. The notfound.php page shows a black 256 by 256 square. The image is not all black tho. Its just some black text on a transparent background in the center.
The fix is
<?php
header('Content-type: image/png');
$im = imagecreatefrompng('simnotfound.png');
imagealphablending($im, true); // setting alpha blending on
imagesavealpha($im, true); // save alphablending setting (important)
imagepng($im);
imagedestroy($im);
?>
Upvotes: 2
Views: 1583
Reputation: 11
bool imagesavealpha ( resource $image , bool $saveflag )
imagesavealpha — Set the flag to save full alpha channel information (as opposed to single-color transparency) when saving PNG images
Upvotes: 1
Reputation: 25554
create your image file one more time with white background to check that is read correctly, if yes - problem is your transparent background
also try with other file to eliminate problem with reading this specific file
Upvotes: 3