query($q); $num = mysql_num_rows($ret); $im = mysql_fetch_array($ret); $imid = $im['resourceID']; header("Content-size: ".$im['size']); header('Content-Disposition: filename='.$im['imageName']); if ( isset($_GET['thumb']) && !strcmp($_GET['thumb'], "1") ) { header("Content-type: image/jpeg"); $imid .= "_thumb"; } else { header("Content-type: ".$im['mime']); } mysql_free_result($ret); readfile(IMAGES_PATH.$imid); ?>