fejl med visning af billede
hej jeg har lavet noget php kode hvor man uploader et jpeg billede og så er jeg kommet til at man skal se det billede man har uploadet som et thumbnail, men når man skal vise villede med imagejpeg() så kommer der bare en masse underlige tegn på hele siden håber der er nogle der kan hjælpe.her er koden:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=windows-1250">
<meta name="generator" content="PSPad editor, www.pspad.com">
<title></title>
</head>
<body>
<?php
include("config.inc.php");
$known_photo_types = array(
'image/pjpeg' => 'jpg',
'image/jpeg' => 'jpg',
'image/gif' => 'gif',
'image/bmp' => 'bmp',
'image/x-png' => 'png'
);
$gd_function_suffix = array(
'image/pjpeg' => 'JPEG',
'image/jpeg' => 'JPEG',
'image/gif' => 'GIF',
'image/bmp' => 'WBMP',
'image/x-png' => 'PNG'
);
if (isset($_POST["pris"]))
{
$photos_uploaded = $_FILES['fil'];
$photo_titel = $_POST["titel"];
$photo_pris = $_POST["pris"];
mysql_query( "INSERT INTO gallery_photos(`photo_filename`, `photo_caption`, `photo_price`) VALUES('0', '".addslashes($photo_titel)."', '".addslashes($photo_pris)."')" );
$new_id = mysql_insert_id();
$filetype = $photos_uploaded['type'];
$extention = $known_photo_types[$filetype];
$filename = $new_id.".".$extention;
mysql_query( "UPDATE gallery_photos SET photo_filename='".addslashes($filename)."' WHERE photo_id='".addslashes($new_id)."'" );
copy($photos_uploaded['tmp_name'], $images_dir."/".$filename);
$size = GetImageSize( $images_dir."/".$filename );
if($size[0] > $size[1])
{
$thumbnail_width = 200;
$thumbnail_height = (int)(200 * $size[1] / $size[0]);
}
else
{
$thumbnail_width = (int)(200 * $size[0] / $size[1]);
$thumbnail_height = 200;
}
$img = imagecreatefromjpeg($images_dir."/".$filename);
if ($img)
echo hejgd2;;
$destination_handle = ImageCreatetruecolor ( $thumbnail_width, $thumbnail_height );
ImageCopyResized( $destination_handle, $img, 0, 0, 0, 0, $thumbnail_width, $thumbnail_height, $size[0], $size[1] );
$img = $destination_handle;
imagejpeg($img,"", 100);
echo $new_id;
echo $photo_titel;
echo $photo_pris;
}
else{
?>
<form method="post" ENCTYPE="multipart/form-data" action="index.php">
<input type="file" name="fil">
<input type="text" value="titel1" name="titel">
<input type="text" value="pris1" name="pris">
<input type="submit" value="Send">
</form>
<?
}
?>
</body>
</html>
