imagecreatefrom string() [<a href='function. imagecreatefrom string'>functio n.imagecreatefr omstring</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("$s ql") or die("Invalid query: " . mysql_error());
header("Content-type: image/jpeg");
$test=mysql_res ult($result,0);
$desired_width = 85;
$desired_height = 110;
$im = imagecreatefrom string($test);/*error here*/
$new = imagecreatetrue color($desired_ width, $desired_height );
$x = imagesx($im);
$y = imagesy($im);
imagecopyresamp led($new, $im, 0, 0, 0, 0, $desired_width, $desired_height , $x, $y);
imagedestroy($i m);
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($n ew);
// echo $test;
mysql_close($li nk);
?>[/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.
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("$s ql") or die("Invalid query: " . mysql_error());
header("Content-type: image/jpeg");
$test=mysql_res ult($result,0);
$desired_width = 85;
$desired_height = 110;
$im = imagecreatefrom string($test);/*error here*/
$new = imagecreatetrue color($desired_ width, $desired_height );
$x = imagesx($im);
$y = imagesy($im);
imagecopyresamp led($new, $im, 0, 0, 0, 0, $desired_width, $desired_height , $x, $y);
imagedestroy($i m);
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($n ew);
// echo $test;
mysql_close($li nk);
?>[/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.
Comment