Hello all,
Im using php 4.3.5 with GD and in php.ini I have allow_url_fopen set to true in php.ini and all the correct settings (I think)..
I constructed the following code to display my images:
$sql="SELECT disp, dispSize from mp_disp where dispID=$_GET[showimage]";
$result = @mysql_query($sql) or die("Invalid query: " . mysql_error());
$size = @mysql_result($result, 0, "dispSize");
$data = @mysql_result($result, 0, "disp");
if($size)
{
header("Content-type: image/jpeg");
header("Content-length: $size");
echo $data;
}
die();
If I then surf to
http://localhost/?showimage=13
the picture is displayed perfectly..
Now what I want to do is the fetch that picture into a Image so manipulate it.. First I try to fetch it into an image...
// Direkt rippad från php.net
function LoadJpeg($imgname)
{
$im = @imagecreatefromjpeg($imgname); /* Attempt to open */
if (!$im) { /* See if it failed */
$im = imagecreate(350, 30); /* Create a blank image */
$bgc = imagecolorallocate($im, 255, 255, 255);
$tc = imagecolorallocate($im, 0, 0, 0);
imagefilledrectangle($im, 0, 0, 350, 30, $bgc);
/* Output an errmsg */
imagestring($im, 1, 5, 5, "Error loading $imgname", $tc);
}
return $im;
}
$im =LoadJpeg("http://localhost/?showimage=13");
header('Content-type: image/jpeg');
imagepng($im);
imagedestroy($im);
die();
I then get an image saying: Error loading http://localhost/?showimage=13
=(
What is wrong? Can anybody help me=)?
-- Rincewind.