header med gd-lib
når jeg forsøger at smide en header på mit dokument får jeg en fejl, men hvis jeg escaper linjen får jeg vist billedet.. hvorfor nu det??<?
require('req/functions.php');
$row = mysql_fetch_assoc(mysql_query("SELECT * FROM $DB._ref_fileext WHERE id='".$_GET['ext']."'"));
if($row['type'] != 'image') php_end();
//header('content-type: image/'.$row['mimetype']);
$image = $_GET['id'].'.'.$row['ext'];
if($_GET['type'] == 'msg')
{
$quality = 75;
$width = 112;
$height = 112;
$image = $PATH_ARR['datauser'].$image;
}
else php_end();
if($_GET['ext'] == 1) $src_img = imagecreatefromgif($image);
elseif($_GET['ext'] == 2) $src_img = imagecreatefromjpeg($image);
elseif($_GET['ext'] == 3) $src_img = imagecreatefrompng($image);
$src_width = imagesx($src_img);
$src_height = imagesy($src_img);
$scale = $src_height / $height;
$dst_width = $src_width / $scale;
$dst_height = $src_height / $scale;
if($width < $dst_width)
{
$scale = $dst_width / $width;
$dst_width = $dst_width / $scale;
$dst_height = $dst_height / $scale;
}
$dst_img = imagecreatetruecolor($dst_width, $dst_height);
imagecopyresampled($dst_img, $src_img, 0, 0, 0, 0, $dst_width, $dst_height, $src_width, $src_height);
if($_GET['ext'] == 1) imagegif($dst_img, '', $quality);
elseif($_GET['ext'] == 2) imagejpeg($dst_img, '', $quality);
elseif($_GET['ext'] == 3) imagepng($dst_img, '', $quality);
imagedestroy($src_img);
imagedestroy($dst_img);
php_end();
?>
