sungpeng Posted May 12, 2009 Share Posted May 12, 2009 Check is it possible to have a transparent water mark at the center of uploaded photo using php? This is to prevent other from unauthorise use your photo. Link to comment https://forums.phpfreaks.com/topic/157780-transparent-water-mark-for-uploaded-images/ Share on other sites More sharing options...
sungpeng Posted May 12, 2009 Author Share Posted May 12, 2009 <?php header('content-type: image/jpeg'); $watermark = imagecreatefrompng('hello.png'); $watermark_width = imagesx($watermark); $watermark_height = imagesy($watermark); $image = imagecreatetruecolor($watermark_width, $watermark_height); $image = imagecreatefromjpeg('notebook.jpg'); $size = getimagesize('notebook.jpg'); $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, "hihi.jpg"); ?> I need the hello.png to be the watermark for notebook.jpg. The code merge both photo together, but the hello.png appear to be total black. Can I know why is that so? Link to comment https://forums.phpfreaks.com/topic/157780-transparent-water-mark-for-uploaded-images/#findComment-832225 Share on other sites More sharing options...
The Little Guy Posted May 12, 2009 Share Posted May 12, 2009 I just replied to a post like this, but here is an easy way to do it. It is a function that I created: http://phpsnips.com/snippet.php?id=105 It has support for these types of positioning: TOP_LEFT TOP_RIGHT BOTTOM_LEFT BOTTOM_RIGHT CENTER It also has support for exact pixel x, y positioning. Link to comment https://forums.phpfreaks.com/topic/157780-transparent-water-mark-for-uploaded-images/#findComment-832706 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.