benim tavsiyem:
1- yuklenen orjinal resmi ayri bir dizinde sakla.
2- orjinal resim ile filigran.png , 2 resmi php ile üst üste getir. boylece basit bir yazi degil logo bile çakabilirsin.
3- oluşan yeni resmi kaydet.

filigran.png transparan , şeffaflığı %15 olan bir resim olsun ki aşırı rahatsiz etmesin.

bu benim yazdiğim ve kullandigim fonksiyonum :

PHP:
  1. function resim_yukle($kaynak,$hedef,$h,$w,$kalite=90,$filigran=0,$temsili=0,$getimagesize=0) {
  2.     @chmod($kaynak,0775);
  3.     if ($getimagesize==0) {
  4.         $image_info = getimagesize($kaynak);
  5.     }
  6.     else {
  7.         $image_info = $getimagesize;
  8.     }
  9.  
  10.     if($image_info['mime'] == 'image/jpg' || $image_info['mime']=='image/jpeg'|| $image_info['mime']=='image/pjpeg') {
  11.         $srcimg=imagecreatefromjpeg($kaynak);
  12.     }
  13.     elseif($image_info['mime'] == 'image/png'|| $image_info['mime'] == 'image/x-png') {
  14.         $srcimg=imagecreatefrompng($kaynak);
  15.     }
  16.     elseif($image_info['mime'] == 'image/gif') {
  17.         $srcimg=imagecreatefromgif($kaynak);
  18.     }
  19.  
  20.     # orjinal wd ,hi
  21.     $o_wd = imagesx($srcimg) ;
  22.     $o_ht = imagesy($srcimg) ;
  23.  
  24.     # hedef resim
  25.     $t_im = imagecreatetruecolor($w,$h);
  26.  
  27.     $white = imagecolorallocate($t_im, 255, 255, 255);
  28.     imagefilledrectangle($t_im, 0, 0, $w, $h, $white);
  29.  
  30.     if($o_wd>$o_ht) {
  31.         # resim yatik
  32.         $new_width = $w;
  33.         $new_height = ($o_ht*$new_width)/$o_wd;
  34.     }
  35.     elseif($o_wd<$o_ht || $o_wd==$o_ht) {
  36.         # resim dik
  37.         $new_height = $h;
  38.         $new_width = ($o_wd*$new_height)/$o_ht;
  39.     }
  40.  
  41.     # eger orjinal resim hedef boyuttan kucuk ise buyutunce bozuluyor, buyutme!
  42.     if( ($o_wd<$w && $o_ht<$h)) {
  43.         imagecopyresampled($t_im, $srcimg, ($w-$o_wd)/2, ($h-$o_ht)/2, 0, 0,$o_wd,$o_ht, $o_wd, $o_ht);
  44.     }
  45.     else {
  46.         imagecopyresampled($t_im, $srcimg, ($w-$new_width)/2, ($h-$new_height)/2, 0, 0,$new_width,$new_height, $o_wd, $o_ht);
  47.     }
  48.  
  49.     # üzerine filigran yazılacak mı?
  50.     if($filigran==1) {
  51.         $logo_file="/images/filigran.png";
  52.         $img_logo = imagecreatefrompng($logo_file);
  53.         $sx = imagesx($img_logo);
  54.         $sy = imagesy($img_logo);
  55.         imagecopy($t_im, $img_logo, round(($w-$sx)/2), round(($h-$sy)/2), 0, 0, $sx, $sy);
  56.     }
  57.  
  58.     # üzerine "Temsili Fotoğraf" yazılacak mı?
  59.     if($temsili==1) {
  60.         # yada baska bir yazi olabilir
  61.         $yazi=" Temsili Fotoğraf ";
  62.         //$font=2;
  63.         $font_file="/monofont.ttf";
  64.         $yer_x=110;
  65.         $yer_y=15;
  66.  
  67.         $bg = imagecolorallocate($t_im, 255, 255, 255);
  68.         $textcolor = imagecolorallocate($t_im, 0, 0, 0);
  69.         ImageFilledRectangle($t_im, $w-$yer_x, $h-$yer_y-10, ($w-$yer_x)+88, ($h-$yer_y)+1, $bg);
  70.         imagettftext($t_im, 9, 0, $w-$yer_x, $h-$yer_y, $textcolor, $font_file, $yazi);
  71.         //imagestring($t_im, $font, $w-$yer_x, $h-$yer_y, $yazi, $textcolor);
  72.     }
  73.  
  74.     if($image_info['mime'] == 'image/jpg' || $image_info['mime']=='image/jpeg'|| $image_info['mime']=='image/pjpeg') {
  75.         imagejpeg($t_im,$hedef,$kalite);
  76.     }
  77.     elseif($image_info['mime'] == 'image/png'|| $image_info['mime'] == 'image/x-png') {
  78.         imagepng($t_im,$hedef);
  79.     }
  80.     elseif($image_info['mime'] == 'image/gif') {
  81.         imagegif($t_im,$hedef);
  82.     }
  83.     imagedestroy($t_im);
  84. }

Kullanım şekli:
resmi 90 kalitede , filigranli , 800x600 yap

PHP:
  1. $dizin = "/resimler/";
  2.         $yeniresim=$_FILES['resim_link'];
  3.         $ozelisim = rand(0,9)."_".time();
  4.         $ext = substr($yeniresim['name'],strrpos($yeniresim['name'], "."));
  5.  
  6.         $userfile_name = strtolower($ozelisim.$ext);
  7.         $userfile_tmp = $yeniresim['tmp_name'];
  8.         $userfile_size = $yeniresim['size'];
  9.         $userfile_type = $yeniresim['type'];
  10.  
  11. resim_yukle($userfile_tmp,$dizin.$userfile_name,600,800,90,1,$getimagesize);

100x100 thumbnail olarak başka dizine kopyala:

PHP:
  1. resim_yukle($userfile_tmp,$dizin."tn/".$userfile_name,100,100,90,0,$getimagesize);

>

Cevapla

Son Yazılar :

utf8 general - utf8 turkish

utf8 general ============================================================= Tablo : DROP TABLE IF EXISTS `tt`; CREATE TABLE IF NOT EXISTS `tt` ( `ad` varchar(255) NOT NULL ) ENGINE=InnoDB DEFAULT CHARSET=utf8; INSERT INTO `tt` (`ad`) VALUES ('istanbul'), [...]

utf8 general - utf8 turkish

utf8 general ============================================================= Tablo : DROP TABLE IF EXISTS `tt`; CREATE TABLE IF NOT EXISTS `tt` ( `ad` varchar(255) NOT NULL ) ENGINE=InnoDB DEFAULT CHARSET=utf8; INSERT INTO `tt` (`ad`) VALUES ('istanbul'), [...]

utf8 general - utf8 turkish

utf8 general ============================================================= Tablo : DROP TABLE IF EXISTS `tt`; CREATE TABLE IF NOT EXISTS `tt` ( `ad` varchar(255) NOT NULL ) ENGINE=InnoDB DEFAULT CHARSET=utf8; INSERT INTO `tt` (`ad`) VALUES ('istanbul'), [...]

utf8 general - utf8 turkish

utf8 general ============================================================= Tablo : DROP TABLE IF EXISTS `tt`; CREATE TABLE IF NOT EXISTS `tt` ( `ad` varchar(255) NOT NULL ) ENGINE=InnoDB DEFAULT CHARSET=utf8; INSERT INTO `tt` (`ad`) VALUES ('istanbul'), [...]

if(5==$deger) yada if ($deger==5)

if(5==$deger) yada if ($deger==5) Sizin de dikkatinizi çekmiştir, Bazı projelerde alıştığımız if şartını ters yazıyorlar; if ($deger==5) yerine if(5==$deger) bu yazımın kaynağı C’den geliyor. = atama. == eşit mi karşılaştırması. C türevi tüm dillerde karşılaştırma operatöri == ‘ dir. Yazılımcılar dalgınlık/unutkanlık ile if’lerde == yerine = (tek eşit) kullanırlarsa büyük bir mantık hatasına ve bug’a sebep olurlar. # root [...]