Files
tilman.de/www/daten/php/imageprovider.php
2011-10-26 10:11:42 +02:00

32 lines
676 B
PHP

<?php
if (isset($_GET['pitem'])) {
$item = $bilderordner.SEPARATOR.$bilderliste[$_GET['pitem']];
$item = dirname($_SERVER['SCRIPT_FILENAME']).SEPARATOR.$item;
$fp = fopen($item, 'r');
// Content-type ermitteln
$imageInfo = getimagesize($item);
switch ($imageInfo[2]) {
case 1:
header('Content-type: image/gif');
break;
case 2:
header('Content-type: image/jpeg');
break;
case 3:
header('Content-type: image/png');
break;
case 4:
header('application/x-shockwave-flash');
break;
default:
header('Content-type: text/plain');
}
fpassthru($fp);
fclose($fp);
exit;
}
?>