imagecreatefromstring() [<a href='function.imagecreatefromstring'>function.ima gecreatefromstring</a>]: gd-jpeg, libjpeg: recoverable error: Premature end of JPEG file\n in
i am getting a error for a image function
[PHP]<?php
error_reporting(E_ALL);
$link = mysql_connect("localhost", "abc", "zxc") or die("Could not connect: " . mysql_error());
mysql_select_db("abc") or die(mysql_error());
$sql = "SELECT Pic FROM uuu WHERE ID='".$_GET['Id']."'";
//'".$_GET['Id']."'";
$result = mysql_query("$sql") or die("Invalid query: " . mysql_error());
header("Content-type: image/jpeg");
$test=mysql_result($result,0);
$desired_width = 85;
$desired_height = 110;
$im = imagecreatefromstring($test);/*error here*/
$new = imagecreatetruecolor($desired_width, $desired_height);
$x = imagesx($im);
$y = imagesy($im);
imagecopyresampled($new, $im, 0, 0, 0, 0, $desired_width, $desired_height, $x, $y);
imagedestroy($im);
header("cache-Control: no-cache, must-revalidate"); // HTTP/1.1
header("Expires: Mon, 26 Jul 1997 05:00:00 GMT"); // Date in the past
header('Content-type: image/jpeg');
imagejpeg($new, NULL, 85);
imagedestroy($new);
// echo $test;
mysql_close($link);
?>[/PHP]
size of image field in database is blob ..i read that changing it to mediumblob will work...will it work or any other ways of solving the prob.