extranet/www/graphs/phpdemo/getchart.php
Michael RICOIS 893f4da173 Ajout de tous les fichiers de l'extranet
Modification de certains chemins
Ajout du framework dans l'extranet
2009-02-17 13:14:53 +00:00

43 lines
1.1 KiB
PHP

<?php
session_cache_limiter("private_no_expire");
if (!session_id()) { session_start(); }
$filename = null;
if (isset($_GET))
{
$image = $_SESSION[$_GET["img"]];
if (isset($_GET["filename"]))
$filename = $_GET["filename"];
}
else
{
$image = $HTTP_SESSION_VARS[$HTTP_GET_VARS["img"]];
if (isset($HTTP_GET_VARS["filename"]))
$filename = $HTTP_GET_VARS["filename"];
}
$contentType = "text/html; charset=utf-8";
if (strlen($image) >= 3)
{
$c0 = ord($image[0]);
$c1 = ord($image[1]);
$c2 = ord($image[2]);
if (($c0 == 0x47) && ($c1 == 0x49))
$contentType = "image/gif";
else if (($c1 == 0x50) && ($c2 == 0x4e))
$contentType = "image/png";
else if (($c0 == 0x42) && ($c1 == 0x4d))
$contentType = "image/bmp";
else if (($c0 == 0xff) && ($c1 == 0xd8))
$contentType = "image/jpeg";
else if (($c0 == 0) && ($c1 == 0))
$contentType = "image/vnd.wap.wbmp";
else if (($c0 == 0x1f) && ($c1 == 0x8b))
header("Content-Encoding: gzip");
}
header("Content-type: $contentType");
if ($filename != null)
header("Content-Disposition: inline; filename=$filename");
print $image;
?>