Copy CodeThe code is as follows:
$filename = './d243375_0.png ';
$filename = Realpath ($filename);
if (!file_exists ($filename)) {
Die ("picture does not exist ~");
}
$size = getimagesize ($filename);
$file _extension = Strtolower (substr (STRRCHR ($filename, "."), 1);
if ("image/png"! = $size [' MIME '] | | $file _extension! = "png") {
Die ("This is not a full PNG image");
}
$img = @imagecreatefrompng ($filename);
if ($img) {
Ob_start ("Output_handler");
Imagepng ($IMG);
Ob_end_flush ();
}else{
Die ("Do not create PNG graphics correctly, please check if PNG graphics are intact ~");
}
function Output_handler ($img) {
Header (' content-type:image/png ');
Header (' Content-length: '. strlen ($img));
return $img;
}
?>
http://www.bkjia.com/PHPjc/322411.html www.bkjia.com true http://www.bkjia.com/PHPjc/322411.html techarticle Copy the code as follows: Php $filename = './d243375_0.png '; $filename = Realpath ($filename); if (!file_exists ($filename)) {die ("picture Not exist ~ ");} $size = getimagesize ($fi ...