Jump to content

Recommended Posts

I'm trying to create a dynamic watermark of my images based on which user owns the image (the site is a image upload/sharing site)

I want to create a semi obaque watermark with the sitename:created by: Username

Any ideas how to do it without doing a text write and without having to create a crazy system of writing my own characters/font face

Yes I believe it can be done.

 

header('Content-Type: image/jpeg');  
$wm = imagecreatefromjpeg('watermark.jpg');
//get dimensions
$h = imagesy($wm);
$w = imagesx($wm);
//load image to be watermarked
$image = imagecreatefromjpeg('image.jpg');
$offset = 10;
$x = imagesx($image) - ($w+$offset);
$y = imagesy($image) - ($h+$offset);
//merges them
imagecopymerge($image, $wm, $x, $y, 0, 0, $w, $h, 100);
imagejpeg($image);
//clear memory
imagedestroy($image);
imagedestroy($wm);

 

Not sure if that works too well, haven't tested it out. But a little fiddling around should make it alright.

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.