hi,
i am trying to capture jpeg file and output it using php but it is not working properly...could anybody tell me whats wrong with this code:

$imgname = "tronny.jpg";
$width = 135;
$size = getimagesize ($imgname);
$im = @imagecreatefromjpeg($imgname); / Attempt to open /
echo "<br>";
if (!$im) { / See if it failed /
echo "failed";
}
else {
$dest_width = $width;
$dest_height = ($width * $size[1]) / $size[0];
$dst_img = imagecreatetruecolor($dest_width,$dest_height);
$test = imagecopyresampled($dst_img, $im, 0, 0, 0, 0, $dest_width, $dest_height, $size[0], $size[1]);
$test2 = imagejpeg($dst_img);
imagedestroy($dst_img);

here's the output:
&#65533;&#65533;&#65533;&#65533;JFIF gd-jpeg v1.0 (using IJG JPEG v62), default quality &#65533;&#65533;&#65533;&#65533;497?????....and a bunch of gibberish??#$%#%$#$%#@$

I checked the gd_info and i do have the gd_library installed ....i have no idea what is wrong with this.
thanks
Help is much appreciated
ko

    You need to output a header. The content-type for a JPEG is image/jpeg.

      hi,
      thanks for your help. when i put the header at the top of the file i got this:

      The image “http://tron/test.php” cannot be displayed, because it contains errors.

      I just added this line at the top of the code:
      Header( "Content-Type: image/jpeg");

      isnt this the right header???
      thanks KO

        Write a Reply...