<?php
include("config.inc.php");
include("Function.inc.php");
session_start();


$connection = mysql_connect($config['dbServer'],$config['dbUser'],$config['dbPass']) or die("Could not connect to DB");
mysql_select_db($_SESSION['dbName'],$connection) or die("Could not find DB");


if ($_GET['option'] == 'fast') {
	$query="Select ItemButton_Picture From ItemButtons Where ItemButton_Id = '".$_GET['id']."' ";
}
else if ($_GET['option'] == 'subgroup') {
	$query="Select SubGroup_Picture From SubGroup Where SubGroup_Code = '".$_GET['id']."'";
}
else if ($_GET['option'] == 'item') {
	$query="Select Item_Picture From Items Where Item_Code = '".$_GET['id']."'";
}


$result=mysql_query($query,$connection) or die(mysql_error());
$row = mysql_fetch_row($result);
$image = $row[0];

header("Content-type: image/jpg");
header("Content-type: image/png");

echo $image;

?>