dcsimg
www.webdeveloper.com
Results 1 to 3 of 3

Thread: watermark?

  1. #1
    Join Date
    Aug 2004
    Posts
    195

    watermark?

    I have a directory that holds all my uploaded image and am trying to figure out how to create watermarks when people wish to view em. Is there a way to add a watermark to evfery image once it is uploaded?
    I tried to follow http://www.sitepoint.com/article/watermark-images-php but got confused as I'm basically a retard with a web site.
    Thanks

  2. #2
    Join Date
    Oct 2005
    Posts
    593
    The code is on that website! As a starting point you need to define watermark.png and src

    <?php

    header('content-type: image/jpeg');

    $watermark = imagecreatefrompng('watermark.png');
    $watermark_width = imagesx($watermark);
    $watermark_height = imagesy($watermark);
    $image = imagecreatetruecolor($watermark_width, $watermark_height);
    $image = imagecreatefromjpeg($_GET['src']);
    $size = getimagesize($_GET['src']);
    $dest_x = $size[0] - $watermark_width - 5;
    $dest_y = $size[1] - $watermark_height - 5;
    imagecopymerge($image, $watermark, $dest_x, $dest_y, 0, 0, $watermark_width, $watermark_height, 100);
    imagejpeg($image);
    imagedestroy($image);
    imagedestroy($watermark);

    ?>

  3. #3
    Join Date
    Oct 2005
    Location
    Gold Coast, Australia
    Posts
    2,115

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center



Recent Articles