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. Quote Link to comment 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? Quote Link to comment 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. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.