Hi
I have many jpg stored within mysql db as blobs. I can display them no problem with.
$query = "select * from photo WHERE photoID = $photoID";
$result = @($query);
$data = @MYSQL_RESULT($result,0,"data");
$type = @MYSQL_RESULT($result,0,"datatype");
Header( "Content-type: $type");
echo("$data");
and using <img src='showpic.php?photoID=$photoID'>
I would like be able to resize the image on the fly. I have the following script.
$query = "select * from photo WHERE photoID = $photoID";
$result = @($query);
$data = @MYSQL_RESULT($result,0,"data");
$image_file = $data; // replacing this with $image_file = "pictureonserver.jpg"; works
//also tried $image_file = "showpic.php?photoID=$photoID";
$width = 100;
$height = 100;
$quality=100;
$original_size = getimagesize($image_file);
$original_width = $original_size[0];
$original_height = $original_size[1];
$original_jpg = imageCreateFromJPEG($image_file);
$resized_jpg = imageCreateTrueColor($width, $height);
imageCopyResized($resized_jpg, $original_jpg, 0, 0, 0, 0, $width, $height, $original_width, $original_height);
imageJPEG($resized_jpg, '', $quality);
imageDestroy($resized_jpg);
Using the data within the mysql blob value doesn't seem to work, but using a jpg on server works perfectly.
Any help would be greatly appreciated. Thank you.