Location: PHPKode > projects > FreeRealty > FR-3.0-0.rc10/agent_image.php
<?php
//$Id: agent_image.php,v 2.11 2007/06/10 17:29:51 pat Exp $
/**
  *\file
  *\brief Displays the agent images out of the database.
  * 
  * There is nothing to see here, move along. */   

if (isset($_REQUEST))
{
 foreach ($_REQUEST as $key=>$value)
 { 
  $$key = $value;
 }
}

if(!isset($Id))
{
    die("Need 'Id' parameter");
} else
{
    $Id=stripslashes($Id);
}

include("common.php");
$link = getdb();

if (config_options('images_use') == "db" || config_options('images_use') != "folders" )
{
 if (isset($image) && $image =='thumb')
  {
   $query = "SELECT thumb_filetype as filetype, thumb as bin_data FROM ".$table_prefix."agent_tbl_Files WHERE id_files='$Id';";
  }
 else 
 {
  $query = "SELECT filetype, bin_data FROM ".$table_prefix."agent_tbl_Files WHERE id_files='$Id';";
 }
 $result = mysql_query($query);
	

 $query_data = mysql_fetch_array($result);
 $bin_data = $query_data['bin_data'];
 $filetype = $query_data['filetype'];
}
else
{
 if (config_options('imageloc') == "")
 {
  $imageloc = "images";
 }
 else {
	 $imageloc = config_options('imageloc');
 }

 $sql = "select filename, id_files, filetype, thumb_filetype from ".$table_prefix."agent_tbl_Files where id_files = $Id";
 $result = mysql_query($sql,$link);
 $query = mysql_fetch_array($result);
 $id = $query['id_files'];
 $filename = $query['filename']; 
 $filetype = $query['filetype'];
 if (isset($image) && $image =='thumb')
 {
  $filetype = $query['thumb_filetype'];
  $filename = "thumb_$filename";
 }
 $bin_data = "$install_path/$imageloc/agents/$id"."_"."$filename";
 $bin_data = fread(fopen($bin_data,"r"), filesize($bin_data));

}
Header("Content-type: $filetype");
echo $bin_data;


?>
Return current item: FreeRealty