imagecopyresampled og mysql
Hej FolkensHar et problem med imagecopyresampled.
<?php
$id = $_GET[id];
include("include/db.php");
$result = mysql_query("SELECT * FROM product WHERE id = '$id' ")or die(mysql_error());
$row = mysql_fetch_array($result);
// The file
echo $filename = 'http://url.dk/sti/upload/'.$row[small_pic];
// Set a maximum height and width
$width = 350;
$height = 150;
// Content type
header('Content-Type: image/jpeg');
// Get new dimensions
list($width_orig, $height_orig) = getimagesize($filename);
$ratio_orig = $width_orig/$height_orig;
if ($width/$height > $ratio_orig) {
$width = $height*$ratio_orig;
} else {
$height = $width/$ratio_orig;
}
// Resample
$image_p = imagecreatetruecolor($width, $height);
$image = imagecreatefromjpeg($filename);
imagecopyresampled($image_p, $image, 0, 0, 0, 0, $width, $height, $width_orig, $height_orig);
// Output
imagejpeg($image_p, null, 100);
?>
Hvorfor melder den fejl. ??