picture_newspath();
$fileshortcode = strtolower(trim($_REQUEST['s']));
$headers = $func->request_headers();
$fn = "$picpath/$fileshortcode";
$myfilemtime = filemtime($fn);
$ersatzbild = "/home/www/wwwbuzzerstar/images/facebook.png";
header('Expires: '.gmdate('D, d M Y H:i:s', time()+7000000).' GMT');
header('Cache-Control: public, max-age=2592000, pre-check=2592000');
header('X-UA-Compatible: IE=edge,chrome=1');
header("Pragma: cache");
// Checking if the client is validating his cache and if it is current.
if (isset($headers['If-Modified-Since']) && (strtotime($headers['If-Modified-Since']) == $myfilemtime)) {
// Client's cache IS current, so we just respond '304 Not Modified'.
header('Last-Modified: '.gmdate('D, d M Y H:i:s', $myfilemtime).' GMT', true, 304);
} else {
// Image not cached or cache outdated, we respond '200 OK' and output the image.
header('Last-Modified: '.gmdate('D, d M Y H:i:s', $myfilemtime).' GMT', true, 200);
}
/*
echo "is_file()" . is_file($fn). "
";
echo "file_exists()" . file_exists($fn). "
";
echo "is_readable()" . is_readable($fn). "
";
echo "filesize()" . filesize($fn) . "
";
exit;
*/
if (is_file($fn) && file_exists($fn) && is_readable($fn) && is_readable($fn) && filesize($fn) >5000 ) {
$finfo = finfo_open(FILEINFO_MIME_TYPE);
$ContentType = finfo_file($finfo, $fn);
//echo "bild quelle: $ContentType
";exit;
header("Content-Type: $ContentType");
header('Content-Length: '.filesize($fn));
readfile($fn);
exit(0);
} else {
$finfo = finfo_open(FILEINFO_MIME_TYPE);
$ContentType = finfo_file($finfo, $ersatzbild);
//echo "ersatz quelle: $ContentType
";exit;
header("Content-Type: $ContentType");
header('Content-Length: '.filesize($ersatzbild));
readfile($ersatzbild);
exit(0);
}
exit(0);
?>