So I'm making a random image script however when I output the image to the browser, it mucks up the transparent background by turning it black. Is there any way I can stop it from doing this and have it simply return the image properly? The code I'm using to output the image: header('Content-type: image/png'); $srcImg = imagecreatefrompng($dir . '/' . $filename); imagepng($finalImg); PHP:
This try. header('Content-type: image/png'); $srcImg = imagecreatefrompng($dir . '/' . $filename); imagesavealpha($finalImg, true); imagepng($finalImg); PHP: