Watermark script

images php coding issues or problems here.

Moderators: macek, egami, gesf

Post Reply
phpbaby

Watermark script

Post by phpbaby » Fri Apr 07, 2006 12:31 am

Hi there,

Anyone know the script to water mark a image in php?

Thanks in advance

sanketce
New php-forum User
New php-forum User
Posts: 90
Joined: Fri Dec 02, 2005 3:23 am

Post by sanketce » Fri Apr 07, 2006 12:59 am

Can you explain in more detail :)

phpbaby

Post by phpbaby » Fri Apr 07, 2006 8:32 am

Hi,

When i add a picture to my server through the form , then a watermark for the uploaded picture is to be added below the picture. The watermark to be added nearly at the bottom of the picture automatically.

User avatar
Alexej Kubarev
Site Admin
Site Admin
Posts: 2223
Joined: Fri Mar 05, 2004 7:15 am
Location: Täby, Stockholms län
Contact:

Post by Alexej Kubarev » Fri Apr 07, 2006 8:57 am


User avatar
Mukseh
New php-forum User
New php-forum User
Posts: 156
Joined: Wed Mar 22, 2006 2:22 am
Location: Ahmedabad, Gujarat, India
Contact:

Water mark

Post by Mukseh » Sun Apr 16, 2006 7:18 pm

Code: Select all

class water_mark {

    public static function apply($watermark, $img) {

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

        $watermark = imagecreatefromgif($watermark);
        $watermark_width = imagesx($watermark);
        $watermark_height = imagesy($watermark);
        $image = imagecreatetruecolor($watermark_width, $watermark_height);
        $image = imagecreatefromgif($img);
        $size = getimagesize($img);
        $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);
    }
}

water_mark::apply('img1.gif','logo.gif');

Post Reply

Who is online

Users browsing this forum: Baidu [Spider] and 1 guest