$query = "SELECT * from binary_data where id='$id' ";
$sql_result = mysql_query($query,$config[connection]) or sql_error("Connection Error");
while( $row = mysql_fetch_array( $sql_result) ) {
$data = $row[bin_data];
}
$width = 100;
$height = 100;
$im = imagecreatefromstring($data);
$new = imagecreatetruecolor($width, $height);
$x = imagesx($im);
$y = imagesy($im);
imagecopyresampled($new, $im, 0, 0, 0, 0, $width, $height, $x, $y);
imagedestroy($im);
header('Content-type: image/jpeg');
imagejpeg($new, null, 95);


