<?
require("conf.php");

$db = mysql_connect($host, $user, $password);
mysql_select_db($usebase,$db);

$result = mysql_query("SELECT image,type,width,height FROM images WHERE id=$imageselect",$db);
if ($myrow = mysql_fetch_array($result)) {
  if ($myrow["filetype"]==1) {
    $filetype='gif';
  } elseif ($myrow["filetype"]==2) {
    $filetype='jpeg';
  } elseif ($myrow["filetype"]==3) {
    $filetype='png';
  } elseif ($myrow["filetype"]==4) {
    $filetype='swf';
  } elseif ($myrow["filetype"]==5) {
    $filetype='psd';
  } else {
    // SEE PHP MANUAL FOR getimagesize for more types
    $filetype='';
  }
 
  $data=$myrow["image"];
  $filetype='jpeg';//$myrow["filetype"];
      Header( "Content-type: $type");
      echo $data;
} else {
  return "No BinaryData with id=$imageselect found";
}
?>

