cooldude832 Posted August 13, 2007 Share Posted August 13, 2007 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 Link to comment https://forums.phpfreaks.com/topic/64594-dynamic-watermarks-with-gd-can-it-be-done/ Share on other sites More sharing options...
lightningstrike Posted August 13, 2007 Share Posted August 13, 2007 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. Link to comment https://forums.phpfreaks.com/topic/64594-dynamic-watermarks-with-gd-can-it-be-done/#findComment-322056 Share on other sites More sharing options...
cooldude832 Posted August 13, 2007 Author Share Posted August 13, 2007 yes i know that to apply it, but i want to make it dynamic and not a font Link to comment https://forums.phpfreaks.com/topic/64594-dynamic-watermarks-with-gd-can-it-be-done/#findComment-322057 Share on other sites More sharing options...
lightningstrike Posted August 13, 2007 Share Posted August 13, 2007 Ahh I see. Sorry can't help you out. There is no simple way of doing it without writing text, I believe. Link to comment https://forums.phpfreaks.com/topic/64594-dynamic-watermarks-with-gd-can-it-be-done/#findComment-322059 Share on other sites More sharing options...
cooldude832 Posted August 13, 2007 Author Share Posted August 13, 2007 yeah i'll have to write a GD program that writes a string as an image (using lines and shapes) but anyone know how to draw opaque layers? Link to comment https://forums.phpfreaks.com/topic/64594-dynamic-watermarks-with-gd-can-it-be-done/#findComment-322061 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.