صفحة 2 من 2 الأولىالأولى 12
النتائج 16 إلى 17 من 17

الموضوع: كيف أضيف علامة مائية على جميع صور الموقع...؟؟

  1. #16


    جميله جداا الفكره دي
    شركا لكم





    __________________
    كن حكيم في استخدام عقلك

  2. #17
    عضو سوبر نشيط
    تاريخ التسجيل
    Dec 2004
    المشاركات
    736


    الشرح والخطوات

    Image Resize and Watermark
    With this script you can resize your image, ad a watermark or copyright to image and output the image in JPEG, GIF or PNG format.

    Usage:
    1. Parameters are passed via URL: image.php?image=1.jpg;
    2. You can set the type of your output image to JPG, GIF or PNG format like this: image.php?image=1.jpg&type=png; If you don’t specify the type of the output image, the script will output the image in the original format image.php?image=1.jpg;
    3. To add a watermark to image you heave to set 2 variables: watermark_text and watermark_color(optional).Black will be use if you do not set the watermark_color;
    Example:
    1) image.php?image=1.jpg&watermark_text=1234567890&watermark_color=fffff;
    2) image.php?image=1.jpg&watermark_text=1234567890;
    4. Resizing images:
    a. Exact size:
    Variables: w and h
    Example: image.php?image=1.jpg&w=100&h=100
    b. Maxim size:
    Variable: maxim_size
    Example: image.php?image=1.jpg&maxim_size=300
    c. Percent:
    Variable: percent
    Example: image.php?image=1.jpg&percent=50
    d. Square:
    Variable: square
    Example: image.php?image=1.jpg&square=100
    I use this type of resizing for creating thumbnails that heave the same size

    For watermarking I use GEORGIA.TTF font;

    <?
    if($_GET['image']){
    $image = $_GET['image'];

    if($_GET['type']=="jpg"){
    header("(anti-spam-(anti-spam-(anti-spam-(anti-spam-content-type:)))) image/jpeg");
    }elseif($_GET['type']=="gif"){
    header("(anti-spam-(anti-spam-(anti-spam-(anti-spam-content-type:)))) image/gif");
    }elseif($_GET['type']=="png"){
    header("(anti-spam-(anti-spam-(anti-spam-(anti-spam-content-type:)))) image/png");
    }else{
    if(substr($image, -3)=="jpg" || substr($image, -3)=="JPG"){header("(anti-spam-(anti-spam-(anti-spam-(anti-spam-content-type:)))) image/jpeg");}
    elseif(substr($image, -3)=="gif" || substr($image, -3)=="GIF"){header("(anti-spam-(anti-spam-(anti-spam-(anti-spam-content-type:)))) image/gif");}
    elseif(substr($image, -3)=="png" || substr($image, -3)=="PNG"){header("(anti-spam-(anti-spam-(anti-spam-(anti-spam-content-type:)))) image/png");}
    }

    if(substr($image, -3)=="jpg" || substr($image, -3)=="JPG"){$im = imagecreatefromjpeg($image);}
    elseif(substr($image, -3)=="gif" || substr($image, -3)=="GIF"){$im = imagecreatefromgif($image);}
    elseif(substr($image, -3)=="png" || substr($image, -3)=="PNG"){$im = imagecreatefrompng($image);}

    if($_GET['percent']){
    $x = round((imagesx($im)*$_GET['percent'])/100);
    $y = round((imagesy($im)*$_GET['percent'])/100);
    $yyy=0;
    $xxx=0;
    $imw = imagecreatetruecolor($x,$y);
    }elseif($_GET['w'] and $_GET['h']){
    $x = $_GET['w'];
    $y = $_GET['h'];
    $yyy=0;
    $xxx=0;
    $imw = imagecreatetruecolor($x,$y);
    }elseif($_GET['maxim_size']){
    if(imagesy($im)>=$_GET['maxim_size'] || imagesx($im)>=$_GET['maxim_size']){
    if(imagesy($im)>=imagesx($im)){
    $y = $_GET['maxim_size'];
    $x = ($y*imagesx($im))/imagesy($im);
    }else{
    $x = $_GET['maxim_size'];
    $y = ($x*imagesy($im))/imagesx($im);
    }
    }else{
    $x = imagesx($im);
    $y = imagesy($im);
    }
    $yyy=0;
    $xxx=0;
    $imw = imagecreatetruecolor($x,$y);
    }elseif($_GET['square']){
    if(imagesy($im)>=$_GET['square'] || imagesx($im)>=$_GET['square']){
    if(imagesy($im)>=imagesx($im)){
    $x = $_GET['square'];
    $y = ($x*imagesy($im))/imagesx($im);
    $yyy=-($y-$x)/2;
    $xxx=0;
    }else{
    $y = $_GET['square'];
    $x = ($y*imagesx($im))/imagesy($im);
    $xxx=-($x-$y)/2;
    $yyy=0;
    }
    }else{
    $x = imagesx($im);
    $y = imagesy($im);
    $yyy=0;
    $xxx=0;
    }
    $imw = imagecreatetruecolor($_GET['square'],$_GET['square']);
    }else{
    $x = imagesx($im);
    $y = imagesy($im);
    $yyy=0;
    $xxx=0;
    $imw = imagecreatetruecolor($x,$y);
    }

    imagecopyresampled($imw, $im, $xxx,$yyy,0,0,$x,$y,imagesx($im), imagesy($im));

    if($_GET['watermark_text']){
    if($_GET['watermark_color']){$watermark_color=$_GET['watermark_color'];
    }else{
    $watermark_color="000000";
    }
    $red=hexdec(substr($watermark_color,0,2));
    $green=hexdec(substr($watermark_color,2,2));
    $blue=hexdec(substr($watermark_color,4,2));

    $text_col = imagecolorallocate($imw, $red,$green,$blue);
    $font = "georgia.ttf"; //this font(georgia.ttf) heave to be in the same directory as this script
    $font_size = 12;
    $angle = 0;
    $box = imagettfbbox($font_size, $angle, $font, $_GET['watermark_text']);
    $x = 5;
    $y = 17;
    imagettftext($imw, $font_size, $angle, $x, $y, $text_col, $font, $_GET['watermark_text']);

    }

    if($_GET['type']=="jpg"){imagejpeg($imw);}
    elseif($_GET['type']=="gif"){imagegif($imw);}
    elseif($_GET['type']=="png"){imagepng($imw);}
    else{
    if(substr($image, -3)=="jpg" || substr($image, -3)=="JPG"){imagejpeg($imw);}
    elseif(substr($image, -3)=="gif" || substr($image, -3)=="GIF"){imagegif($imw);}
    elseif(substr($image, -3)=="png" || substr($image, -3)=="PNG"){imagepng($imw);}
    }

    imagedestroy($imw);
    }
    ?>
    وهذا مثال غيره

    http://baglan.web.tr/media/watermark...with-cache.zip





    __________________
    jeddah (#) hotmail.com
    www.vela.ae





ضوابط المشاركة

  • لا تستطيع إضافة مواضيع جديدة
  • لا تستطيع الرد على المواضيع
  • لا تستطيع إرفاق ملفات
  • لا تستطيع تعديل مشاركاتك
  •  

أضف موقعك هنا| اخبار السيارات | حراج | شقق للايجار في الكويت | بيوت للبيع في الكويت | دليل الكويت العقاري | مقروء | شركة كشف تسربات المياه | شركة عزل اسطح بالرياض | عزل فوم بالرياض| عزل اسطح بالرياض | كشف تسربات المياة بالرياض | شركة عزل اسطح بالرياض