<!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.