Add watermark to images

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • nicutdk
    Member
    • Aug 2010
    • 60
    • 4.0.x

    [Forum] Add watermark to images

    Hi,

    It is possible to add watermark on images with ".htaccess" if they are stored in the database ?

    I have a script and works fine with files stored in directory.

    .htaccess
    Code:
    RewriteEngine On
    RewriteCond %{REQUEST_FILENAME} -f
    RewriteRule .(gif|jpeg|jpg|png)$ /images/watermark.php [QSA,NC]

    watermark.php
    PHP Code:
    <?php
    $path 
    $_SERVER['DOCUMENT_ROOT'].$_SERVER['REQUEST_URI'];
    $image imagecreatefromstring(file_get_contents($path));
    $w imagesx($image);
    if (
    $w 500) {
    $h imagesy($image);
    $watermark imagecreatefrompng('watermark.png');
    $ww imagesx($watermark);
    $wh imagesy($watermark);
    imagecopy($image$watermark$w-$ww$h-$wh00$ww$wh);
    }
    header('Content-type: image/jpeg');
    imagejpeg($image);
    exit();
    ?>

    P.S. I read the forum that this feature will appear in version 4.1. Is this true? If yes, when version 4.1 will appear?


    Best Regards,
  • sulasno
    Senior Member
    • Feb 2010
    • 323
    • 4.0.0

    #2
    what does watermark.php does ?

    adds 'watermark.png' to the image ?

    where do I put .htaccess, watermark.php and watermark.png ? tia
    http://sulasno.bravehost.com/android.png

    Comment

    • nicutdk
      Member
      • Aug 2010
      • 60
      • 4.0.x

      #3
      Originally posted by sulasno
      what does watermark.php does ?

      adds 'watermark.png' to the image ?

      where do I put .htaccess, watermark.php and watermark.png ? tia
      you must create with image editor a watermark.png

      watermark.png is a picture with watermark text and put on every images from directory where put .htacess



      THIS SCRIPT WORKS ONLY WITH IMAGES STORED IN DIRECTORIES NOT IN DATABASE

      Comment

      • nicutdk
        Member
        • Aug 2010
        • 60
        • 4.0.x

        #4
        Nobody ?

        Comment

        • Mopar1973Man
          Senior Member
          • Nov 2009
          • 1125
          • 4.2.X

          #5
          Any updates on this mod??? I'm really looking for a watermark addon bad...
          Mopar1973Man.Com Forum and Article Database Powered By vBulletin 4.2.0 & Joomla 2.5.11 -~- Michael Nelson -> SoonTM to be Invision Power Board Powered
          Posted With Ubuntu Linux 12.04.2

          Comment

          • AGIRABI
            Member
            • Oct 2005
            • 45

            #6
            Originally posted by Mopar1973Man
            Any updates on this mod??? I'm really looking for a watermark addon bad...
            +1 me2

            Comment

            • nicutdk
              Member
              • Aug 2010
              • 60
              • 4.0.x

              #7
              if VB4 have possibility to change the the files ("1.attach", "2.attach"....) into ("1.jpg", "2.jpg".....) it is very simple with this script.

              You can try to use this script and works fine (just change RewriteRule .(attach|jpeg|jpg|png)$ /images/watermark.php [QSA,NC]) but if you store in VB4 other files (mp3, avi....) you have a problem.

              solution would be if VB4 can make possibility to store pictures files into folder with normal extension not a .attach

              Comment

              • the_bolo
                New Member
                • Apr 2008
                • 10
                • 3.6.x

                #8
                This is such a novel and clever approach to watermarking!

                But are there any performance issues with this?

                Comment

                widgetinstance 262 (Related Topics) skipped due to lack of content & hide_module_if_empty option.
                Working...