| | #1 |
| Bhadra Join Date: 2012
Posts: 47
Thanks: 18
Thanked 0 Times in 0 Posts
|
I have a photo sharing website where users upload their pics. I want to add a logo of my website below the image and make it a part of the image when it is uploaded in the server so that whenever the image gets downloaded from the server, it will show the image and my logo at the bottom. Many sites use this technique. How to do this? Thanks in advance. |
| | |
| |
| | #2 |
| Advanced Warrior War Room Member Join Date: 2004 Location: Perth, Australia.
Posts: 724
Thanks: 6
Thanked 184 Times in 136 Posts
|
Hi devaldcool, What you want is "WaterMarking". This is done either at upload time, but more commonly just before the image is displayed. Your servers needs to have graphics installed, so if its a PHP site, you will need to check to see that PHP has been compiled with the GD library. You can do that by making a simple 1 line php program that looks like this: <?php phpinfo(); ?> Put this on your server and then run it. If you see GD referenced in the results, then you are good to go. Otherwise you may have top contact your hosting company and get them to recompile PHP with the GD library. The following PHP code snippet may help you get things rolling: <? // Load the stamp and the photo to apply the watermark to $stamp = imagecreatefrompng('stamp.png'); $im = imagecreatefromjpeg('photo.jpeg'); // Set the margins for the stamp and get the height/width of the stamp image $marge_right = 10; $marge_bottom = 10; $sx = imagesx($stamp); $sy = imagesy($stamp); // Copy the stamp image onto our photo using the margin offsets and the photo // width to calculate positioning of the stamp. imagecopy($im, $stamp, imagesx($im) - $sx - $marge_right, imagesy($im) - $sy - $marge_bottom, 0, 0, imagesx($stamp), imagesy($stamp)); // Output and free memory header('Content-type: image/png'); imagepng($im); imagedestroy($im); ?> I must give credit to [URLhttp://stackoverflow.com/questions/2235152/add-watermark-to-images-with-php]XUE Can[/URL], as he wrote the snippet and I just "borrowed" it.. I hope this helps you out.. Bruce |
| |
| The Following User Says Thank You to Bruce Hearder For This Useful Post: |
| | #3 | |
| Bhadra Join Date: 2012
Posts: 47
Thanks: 18
Thanked 0 Times in 0 Posts
|
![]() I also want to ask that when I want to display the image on my website, I do not want to display the logo. But when it gets downloaded, it displays the logo. | |
| | ||
| |
| | #4 |
| Advanced Warrior War Room Member Join Date: 2006 Location: USA
Posts: 1,907
Thanks: 236
Thanked 1,377 Times in 676 Posts
|
Like Bruce mentioned, the GD library can do this. Also, Image Magick is another good option... http://www.imagemagick.org/Usage/annotating/ |
| | |
| |
| | #5 | |
| Advanced Warrior War Room Member Join Date: 2004 Location: Perth, Australia.
Posts: 724
Thanks: 6
Thanked 184 Times in 136 Posts
|
best to watermark everything, with something that is subtle but distinctive.. Hope that helps.. Bruce | |
| Last edited on 6th Feb 2013 at 07:41 PM. Reason: Correction to statement | ||
| |
|
| Bookmarks |
| Tags |
| add, bottom, image, logo, server, uploaded |
| |