Register Advertise with usHelp Desk Today's Posts Search

Closed Thread
Thread Tools Search this Thread
Unread 6th Feb 2013, 05:43 AM   #1
Bhadra
 
Join Date: 2012
Posts: 47
Thanks: 18
Thanked 0 Times in 0 Posts
Default
Add logo in the bottom of image when uploaded in server
Share on: 
fb share twitter share gplus share more share

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.

devaldcool is offline  
Unread 6th Feb 2013, 08:03 AM   #2
Advanced Warrior
War Room Member
 
Bruce Hearder's Avatar
 
Join Date: 2004
Location: Perth, Australia.
Posts: 724
Thanks: 6
Thanked 184 Times in 136 Posts
Default
Re: Add logo in the bottom of image when uploaded in server
Share on: 
fb share twitter share gplus share more share

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
Bruce Hearder is offline  
The Following User Says Thank You to Bruce Hearder For This Useful Post:
Unread 6th Feb 2013, 08:43 AM   #3
Bhadra
 
Join Date: 2012
Posts: 47
Thanks: 18
Thanked 0 Times in 0 Posts
Default
Re: Add logo in the bottom of image when uploaded in server
Share on: 
fb share twitter share gplus share more share

Originally Posted by Bruce Hearder View Post

Hi devaldcool,

What you want is "WaterMarking"......I hope this helps you out..

Bruce
Thank you Bruce, for your help. I was seacrhing for this for about 6 hours but could not find it. Thanks...


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.

devaldcool is offline  
Unread 6th Feb 2013, 09:05 AM   #4
Advanced Warrior
War Room Member
 
Brandon Tanner's Avatar
 
Join Date: 2006
Location: USA
Posts: 1,907
Thanks: 236
Thanked 1,377 Times in 676 Posts
Default
Re: Add logo in the bottom of image when uploaded in server
Share on: 
fb share twitter share gplus share more share

Like Bruce mentioned, the GD library can do this. Also, Image Magick is another good option...

http://www.imagemagick.org/Usage/annotating/


Brandon Tanner is offline  
Unread 6th Feb 2013, 07:37 PM   #5
Advanced Warrior
War Room Member
 
Bruce Hearder's Avatar
 
Join Date: 2004
Location: Perth, Australia.
Posts: 724
Thanks: 6
Thanked 184 Times in 136 Posts
Default
Re: Add logo in the bottom of image when uploaded in server
Share on: 
fb share twitter share gplus share more share

Originally Posted by devaldcool View Post

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.
Its impossible to tell the difference between someone downloading an image and viewing an image inside a web page.

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
Bruce Hearder is offline  
Closed Thread


Bookmarks

Tags
add, bottom, image, logo, server, uploaded


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off




All times are GMT -6. The time now is 04:11 AM.