Hi, I'm trying an image resizing peice of PHP at the moment and I'm having a nightmare with it. I keep getting either
"Warning: imagecopyresampled(): supplied argument is not a valid Image resource"
or a load of nonsense like
"ÿÛ�C� $.' ",#(7),01444'9=82<.342ÿÛ�C •–—˜™š¢£¤¥¦§¨©ª²³´µ"
The code is:
<?php
require('../../includes/globals.php');
$image_id = $_GET['image_id'];
$result = mysql_query("SELECT news_image FROM tbl_news WHERE news_id = '$image_id'");
while($row = mysql_fetch_array($result)){
$image = "http://www.theipp.co.uk/images/news/".$row['news_image']."";
$size = getimagesize($image);
$width = $size[0];
$height = $size[1];
$imgw = 120; // Sets the width of the thumbnail
$imgh = $height / $width * $imgw;
$thumb = imagecreatefromjpeg($image);
imagecopyresampled($thumb,$image,0,0,0,0,$imgw,$imgh,$width,$height);
$out = imagejpeg($thumb);
header("content-type: image/jpeg");
echo $out;
echo $image;
}
?>
Thanks