<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>DragDropCart - Photo Upload</title>
</head>
<body>
<?php
include('../includes/config.php');
include('includes/functions.php');
if($_FILES['productimage']['name'] != "") {
$sourcename = "source_".$_FILES['productimage']['name'];
move_uploaded_file($_FILES['productimage']['tmp_name'], getOptionValue('ddcartpath')."productimages/".$sourcename);
//create regular sized copy
$srcImg = imagecreatefromjpeg(getOptionValue('ddcartpath')."productimages/".$sourcename);
$origWidth = imagesx($srcImg);
$origHeight = imagesy($srcImg);
$ratio = 400 / $origWidth; // 300 is width
$thumbHeight = $origHeight * $ratio;
$thumbImg = imagecreatetruecolor(400, $thumbHeight);
fastimagecopyresampled($thumbImg, $srcImg, 0, 0, 0, 0, 400, $thumbHeight, $origWidth, $origHeight); //300 is width
imagejpeg($thumbImg, getOptionValue('ddcartpath')."productimages/"."reg_".$_FILES['productimage']['name']);
//create thumb sized copy
$srcImg = imagecreatefromjpeg(getOptionValue('ddcartpath')."productimages/".$sourcename);
$origWidth = imagesx($srcImg);
$origHeight = imagesy($srcImg);
$ratio = 100 / $origWidth; // 300 is width
$thumbHeight = $origHeight * $ratio;
$thumbImg = imagecreatetruecolor(100, $thumbHeight);
fastimagecopyresampled($thumbImg, $srcImg, 0, 0, 0, 0, 100, $thumbHeight, $origWidth, $origHeight); //300 is width
imagejpeg($thumbImg, getOptionValue('ddcartpath')."productimages/"."thumb_".$_FILES['productimage']['name']);
$imgdivname = time();
?>
<script type="text/javascript">
window.opener.imageAdd('<?php echo $_FILES['productimage']['name']; ?>', '<?php echo $imgdivname; ?>');
</script>
Image uploaded. <a href="photoupload.php">Upload another image.</a>
<?php
} else {
?>
<p><strong>Important Note:</strong> Make sure that your images have unique filenames. Uploading an image that has the same filename as an image already in the system will cause it to be overwritten!</p>
<form method="post" action="photoupload.php" enctype="multipart/form-data">
Image File: <input type="file" name="productimage" /> <input type="submit" value="Upload" />
</form>
<?php
} ?>
</body>
</html>kod bu arkadaşlar upload yaptığı fotoğrafın boyutunu değiştirmemesini istiyorum ne yapmam gerekli? yardımcı olursanız çok teşekkür ederim.
Resim upload boyutunu değiştirmek
13
●1.046
- 25-11-2010, 21:11:00Üyeliği durduruldu
- 26-11-2010, 03:40:35
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>DragDropCart - Photo Upload</title> </head> <body> <?php include('../includes/config.php'); include('includes/functions.php'); if($_FILES['productimage']['name'] != "") { $sourcename = "source_".$_FILES['productimage']['name']; move_uploaded_file($_FILES['productimage']['tmp_name'], getOptionValue('ddcartpath')."productimages/".$sourcename); //create regular sized copy $srcImg = imagecreatefromjpeg(getOptionValue('ddcartpath')."productimages/".$sourcename); imagejpeg($srcImg, getOptionValue('ddcartpath')."productimages/"."reg_".$_FILES['productimage']['name']); //create thumb sized copy $srcImg = imagecreatefromjpeg(getOptionValue('ddcartpath')."productimages/".$sourcename); $origWidth = imagesx($srcImg); $origHeight = imagesy($srcImg); $ratio = 100 / $origWidth; // 300 is width $thumbHeight = $origHeight * $ratio; $thumbImg = imagecreatetruecolor(100, $thumbHeight); fastimagecopyresampled($thumbImg, $srcImg, 0, 0, 0, 0, 100, $thumbHeight, $origWidth, $origHeight); //300 is width imagejpeg($thumbImg, getOptionValue('ddcartpath')."productimages/"."thumb_".$_FILES['productimage']['name']); $imgdivname = time(); ?> <script type="text/javascript"> window.opener.imageAdd('<?php echo $_FILES['productimage']['name']; ?>', '<?php echo $imgdivname; ?>'); </script> Image uploaded. <a href="photoupload.php">Upload another image.</a> <?php } else { ?> <p><strong>Important Note:</strong> Make sure that your images have unique filenames. Uploading an image that has the same filename as an image already in the system will cause it to be overwritten!</p> <form method="post" action="photoupload.php" enctype="multipart/form-data"> Image File: <input type="file" name="productimage" /> <input type="submit" value="Upload" /> </form> <?php } ?> </body> </html>denemedim ama - 26-11-2010, 17:02:19Üyeliği durdurulduolmadı hala aynı hocamTontonq adlı üyeden alıntı: mesajı görüntüle
$ratio = 100
le bir alakası var değiştirdiğimde resimler değişiyor sanırım bir denklem sözkonusu bunu aradan nasıl çıkarta biliriz? - 26-11-2010, 17:11:25Üyeliği durduruldusitenin anasayfasındaki ürünlerin resmi thumb olarak olucak ama ürün detaylarına geldiğinde fotoğraf normal boyutunda olucak yada biraz daha küçüğü (şuanda gerçekten çok küçük duruyor)Tontonq adlı üyeden alıntı: mesajı görüntüle
- 26-11-2010, 17:27:34
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>DragDropCart - Photo Upload</title> </head> <body> <?php include('../includes/config.php'); include('includes/functions.php'); if($_FILES['productimage']['name'] != "") { $sourcename = "source_".$_FILES['productimage']['name']; move_uploaded_file($_FILES['productimage']['tmp_name'], getOptionValue('ddcartpath')."productimages/".$sourcename); //create regular sized copy $srcImg = imagecreatefromjpeg(getOptionValue('ddcartpath')."productimages/".$sourcename); imagejpeg($srcImg, getOptionValue('ddcartpath')."productimages/"."reg_".$_FILES['productimage']['name']); //create thumb sized copy $srcImg = imagecreatefromjpeg(getOptionValue('ddcartpath')."productimages/".$sourcename); $origWidth = imagesx($srcImg); $origHeight = imagesy($srcImg); $ratio = 100 / $origWidth; // 300 is width $thumbHeight = $origHeight * $ratio; $thumbImg = imagecreatetruecolor($origWidth, $origHeight); fastimagecopyresampled($thumbImg, $srcImg, 0, 0, 0, 0, $origWidth, $origHeight, $origWidth, $origHeight); //300 is width imagejpeg($thumbImg, getOptionValue('ddcartpath')."productimages/"."thumb_".$_FILES['productimage']['name']); $imgdivname = time(); ?> <script type="text/javascript"> window.opener.imageAdd('<?php echo $_FILES['productimage']['name']; ?>', '<?php echo $imgdivname; ?>'); </script> Image uploaded. <a href="photoupload.php">Upload another image.</a> <?php } else { ?> <p><strong>Important Note:</strong> Make sure that your images have unique filenames. Uploading an image that has the same filename as an image already in the system will cause it to be overwritten!</p> <form method="post" action="photoupload.php" enctype="multipart/form-data"> Image File: <input type="file" name="productimage" /> <input type="submit" value="Upload" /> </form> <?php } ?> </body> </html>böyle dene?