• 25-11-2010, 21:11:00
    #1
    Üyeliği durduruldu
    <!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.
  • 26-11-2010, 03:40:35
    #2
    <!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
    #3
    Üyeliği durduruldu
    Tontonq adlı üyeden alıntı: mesajı görüntüle
    <!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
    olmadı hala aynı hocam
    $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:03:01
    #4
    güzel kardeşim o thumb resmi değilmi napacan onu değiştirip sen asıl resimden bahsetmiyormusun?
  • 26-11-2010, 17:11:25
    #5
    Üyeliği durduruldu
    Tontonq adlı üyeden alıntı: mesajı görüntüle
    güzel kardeşim o thumb resmi değilmi napacan onu değiştirip sen asıl resimden bahsetmiyormusun?
    sitenin 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)
  • 26-11-2010, 17:27:34
    #6
    <!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?
  • 26-11-2010, 17:34:04
    #7
    Üyeliği durduruldu
    evet hocam tam istediğim oldu fakat anasayfadada büyük gözüküyor pm attım size uğraştığınız için çok teşekkürler
  • 26-11-2010, 17:43:44
    #8
    iyi de tam olarak ne istediğini anlatmazsan nasıl yardımcı olayım fotoğrafı küçültmesin istiyordun orjinal fotoğrafı orjinal boyutta saklasın diye düzelttim thumb küçük dedin onu da büyüttük ya ben anlayamıyorum ya sen anlatamıyorsun
  • 26-11-2010, 17:54:06
    #9
    Üyeliği durduruldu
    anasayfadaki thumb olucak ama ürün detayındaki orjinal boyutta olucak hocam