How to output a PNG with GD with same headers as pre-existing PNG file

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



I am trying to get a PNG created with GD to output exactly as a pre-existing PNG file on the server I have an app that is being very finicky about how it is loading images :(

Within Quicktime, If I point to the PNG file directly on the server, it works.

this works:
$image = isset($_GET['image'])? $_GET['image']:"yolanda.png";
$image = "./".$image;
$imageInfo = getimagesize($image);
$mime = $imageInfo['mime'];

header("Content-type:".$mime);
header ("Content-Length:".filesize($image));
header ("Cache-Control:".$cacheInfo);
readfile($image);



If I output a PNG with GD, it does not work within Quicktime for the PC.
My guess is that Quicktime for PC is very finicky when it comes to headers :(

[excerpt from php script]

$im    = imagecreatefrompng($image);
imagettftext($im, $fontSize, 0, 17, 20, $color, $font, $text);
imageAlphaBlending($im, true);
imageSaveAlpha($im, true);

//    Output handler
function output_handler($im) {
   header('Content-type: image/png');
   header('Content-Length: ' . strlen($im));
   header('Cache-Control:no-store, no-cache');
   return $im;
}

//    Image output
ob_start("output_handler");
imagepng($im);
ob_end_flush();


anyone know a bullet proof way to output the headers to look like a pre-existing PNG file ?

many thanks in advance

g

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux