Fastest example to output image

$file = 'myimage.png';
$size = getimagesize($file);
 
$fp = fopen($file, 'rb');
 
if ($size and $fp)
{
    header('Content-Type: '.$size['mime']);
    header('Content-Length: '.filesize($file));
    fpassthru($fp);
}

Leave a Reply