<?php // Copyright by Mateusz Rusin C 2005 // 1.5
$ini_ini = is_file ('ini.ini') ? parse_ini_file (file_get_contents ('ini.ini')) : parse_ini_file ('../' . file_get_contents ('../ini.ini'));
include (strtolower ($ini_ini ['dbType']) . '.class.php');
$db =& new db ($ini_ini ['dbName'], $ini_ini ['dbServer'], $ini_ini ['dbUser'], $ini_ini ['dbPassword']);
$id = isset ($_GET ['id']) && is_int ((int) ($_GET ['id'])) ? (int) $_GET ['id'] : 1;
$size = 'thumb';
if (isset ($_GET ['size']))
	switch ($_GET ['size'])
	{
		case 'thumb': 
		case 'zoom': 
		case 'full': 
			$size = $_GET ['size'];
	}
$result = $db -> select ('news', 'news_id = ' . $id, $size . ', type');
$photo = $db -> fetch_row ($result);
if (isset ($_GET ['no_cache']))
{
	header ('Expires: Mon, 26 Jul 1997 05:00:00 GMT');
	header ('Last-Modified: ' . gmdate ('D, d M Y H:i:s') . ' GMT'); 
	header ('Cache-Control: no-store, no-cache, must-revalidate');
	header ('Cache-Control: post-check=0, pre-check=0', false);
	header ('Pragma: no-cache');                          
}
header ('Content-type: ' . $photo [1]);
//header ('Content-type: image/jpeg');
header ('Content-Length: ' . strlen ($photo [0]));
print $photo [0];
?>