< >

error-image-mit-php-erstellen.php


Quell Code


<?php
function LoadPNG($imgname){
    $im = @imagecreatefrompng($imgname);
    if(!$im) {
        $im  = imagecreatetruecolor(330, 40);
        $bgc = imagecolorallocate($im, 255, 0, 44);
        $tc  = imagecolorallocate($im,222, 0, 222);
        imagefilledrectangle($im, 0, 0, 450, 60, $bgc);
        imagestring($im,222,22, 11, 'Fehler beim Laden von ' . $imgname, $tc);
    }

    return $im;
}
header('Content-Type: image/png');
$img = LoadPNG('bogus.image');
imagepng($img);
imagedestroy($img);

error_reporting(E_ALL); 
ini_set('display_errors', true);
?>