Hi, i am trying to display an image on an html page usign the below fetch script to pull an image from a database. This script will not work because my $img variable is a binary resource, not a path like getimagesize wants. What changes can i make to accomodate this case?
Thanks in advance
<?php
if(isset($GET['car_id']) && isset($GET['image_num']))
{
$car_id = $GET['car_id'];
$img_num= 'img';
$img_num .= $GET['image_num'];
//Get Image
require_once ('dbconnect.php');
$sql = "select $img_num from auto where id=$car_id";
$imgresult = mysql_query("$sql");
header("Content-type: image/jpeg;");
$img = mysql_result($imgresult, 0, $img_num);
$percent = 0.5;
list($width, $height) = getimagesize($img);
$new_width= $width * $percent;
$new_height = $height * $percent;
//Resample
$image_p = imagecreatetruecolor($new_width, $new_height);
$image = imagecreatefromjpeg($img);
imagecopyresampled($image_p, $image, 0,0,0,0, $new_width, $new_height, $width, $height);
imagepeg($image_p, null, 100);
}
?>