Merhaba, Ziyaretçi. Lütfen giriş yapın veya üye olun.
Aktivasyon mailiniz gelmediyse buraya tıklayın.
06, 2008, 08:02:33 pm
42719 Mesaj 8080 Konu Gönderen: 17918 Üye
Son üye: tlord
Turk-Php.Com Forum  |  Yardım Forumları  |  PHP Yardım Forumu  |  resim upload sorunu « önceki sonraki »
Sayfa: [1] Yazdır
Yazan Konu: resim upload sorunu  (Okunma Sayısı 80 defa)
Sedefkaya
Yeni Kullanıcılar
*
Offline Offline

Mesaj Sayısı: 1


Üyelik Bilgileri
resim upload sorunu
« : 11, 2008, 08:45:40 am »

merhaba arkadaşlar bir çok foruma üye oldum fakat kimse yardımcı olmak istemedi veya bilmiyorlar, çareyi sizin siteye üye olarak buldum yardım ederseniz çok sevinirim.

arkadaşlar elimde bir resim upload sitesi var herhangi bir resim yüklediğim örnek resimin orjianal boyutu 600 x 400 diyelim fakat otomotik olarak resmi 320 x 290 yapiyor, fakat benim istediğim ise 320 x 290 yerine 600 x 400 yapmak rakamlarin yerini değiştirdim oldu fakat, bazı resimler ise küçük boyutlu diyelim 100 x 100 bu resim 600 x 400 olunca çok berbat gösteriyor yani anlayacağınız benim istediğim 600 x 400 ten büyük resimleri 600 x 400 boyuna ayarlamak ve 600 x 400 ten küçük resimleri ise olduğu gibi bırakma, size göstereceğim kodlar böyle yardım edersiniz sevinirim saygılarla...!

Kod:
<?php
 
/***************************************************************************
 *
 *   Copyright © 2007. All Rights Reserved.
 *   -------------------------------------
 *   Version: 2.1
 *   -------------------------------------
 *
 ****************************************************************************
 *   Page: vico.images.php
 ***************************************************************************/
 
 
Header("Content-type: image/jpeg");
 
 
$thumbnail_picture $_GET['picture'];
 
 if (
substr($thumbnail_picture, -4) == '.php')
 die(
'hacking attempt...');
 
 
$thumbnail_picture str_replace("../pictures/","",$thumbnail_picture);
 
 if (
$_GET['thumbnail'] == 'FALSE' ) {
 
 
$cache_filename $thumbnail_picture;
 
 
$thumbnail_width '600';
 
$thumbnail_height '400';
 
 } else {
 
 
$cache_filename "THUMB_".$thumbnail_picture;
 
 
$thumbnail_width '84';
 
$thumbnail_height '84';
 
 }
 
 
 if (
file_exists("../pictures_cache/".$cache_filename)) {
 
 
header ("Content-Length: ".filesize("../pictures_cache/".$cache_filename));
 
readfile ("../pictures_cache/".$cache_filename);
 
 } else {
 
 
$system explode('.',strtolower($thumbnail_picture));
 
 if (
preg_match('/jpg|jpeg/',$system[1])){
 
$orig_image imagecreatefromjpeg("../pictures/".$thumbnail_picture);
 }
 
 if (
preg_match('/png/',$system[1])){
 
$orig_image imagecreatefrompng("../pictures/".$thumbnail_picture);
 }
 
 if (
preg_match('/gif/',$system[1])){
 
$orig_image imagecreatefromgif("../pictures/".$thumbnail_picture);
 }
 
 list(
$width$height$type$attr) = getimagesize("../pictures/".$thumbnail_picture); 
 
 if (
$width 450) { 
 
 
$ratio 450 $width
 
 
$newheight $ratio $height
 
 
$newwidth 450;
 
 } else { 
 
 
$newwidth $width;
 
$newheight $height
 
 }
 
 
 
$newwidth $thumbnail_width;
 
$newheight $thumbnail_height;
 
 
$sm_image imagecreatetruecolor($newwidth$newheight) or die ("Cannot Initialize GD Image");
 
 
imagecopyresampled($sm_image$orig_image0000$newwidth$newheight
 
imagesx($orig_image), imagesy($orig_image)); 
 
 
imagejpeg($sm_image,'',80); 
 
imagejpeg($sm_image,"../pictures_cache/".$cache_filename,80);
 
imagedestroy($sm_image); 
 
imagedestroy($orig_image);
 }

 
?>
Logged
Sayfa: [1] Yazdır 
« önceki sonraki »
Gitmek istediğiniz yer:  


Turk-Php.Com Forum | SMF Forum Software © 2005, Simple Machines LLC. All Rights Reserved.