image output in php with header('Content-Type: image/png'); -
i'm using code uotput image not getting error not display image too...
// test image. $fn = '/itunes.png'; // getting headers sent client. $headers = apache_request_headers(); // checking if client validating cache , if current. if (isset($headers['if-modified-since']) && (strtotime($headers['if-modified-since']) == filemtime($fn))) { // client's cache current, respond '304 not modified'. header('last-modified: '.gmdate('d, d m y h:i:s', filemtime($fn)).' gmt', true, 304); } else { // image not cached or cache outdated, respond '200 ok' , output image. header('last-modified: '.gmdate('d, d m y h:i:s', filemtime($fn)).' gmt', true, 200); header('content-length: '.filesize($fn)); header('content-type: image/png'); echo file_get_contents($fn); }
can help?
Comments
Post a Comment