NamePros
Welcome, Guest! Ready to make a name for yourself in the domain business? We welcome both the hobbyist and professional domainer to join the discussion as part of the NamePros community.

Click here to create your profile to start earning reputation for posting, and trader ratings for buying & selling in our free e-marketplace. Build your trader rating with each successful sale. Our system has tracked over 100,000 sales and counting!
FAQ & TOS Register Search Today's Posts Mark Forums Read

Go Back   NamePros.com > Website Development Discussion Forums > Programming
Reload this Page watermark on upload

Programming PHP, Perl, Ruby on Rails, AJAX, HTML, XHTML, CSS, JavaScript, MySQL and any other coding topics.

Advanced Search


Closed Thread
 
LinkBack Thread Tools
Old 03-31-2005, 04:09 AM THREAD STARTER               #1 (permalink)
NamePros Regular
 
joeorgasmic's Avatar
Join Date: Sep 2004
Location: Earth
Posts: 394
joeorgasmic will become famous soon enoughjoeorgasmic will become famous soon enough
 



watermark on upload


I'm starting a free image hosting site and I'm looking for a script that can add a small watermark (that displays link to my site) to each image when the user uploads it. Any suggestions?
joeorgasmic is offline  
Old 03-31-2005, 05:07 AM   #2 (permalink)
Senior Member
 
luxinterior's Avatar
Join Date: Jul 2004
Location: Kizmiaz
Posts: 1,091
luxinterior is a glorious beacon of lightluxinterior is a glorious beacon of lightluxinterior is a glorious beacon of lightluxinterior is a glorious beacon of lightluxinterior is a glorious beacon of lightluxinterior is a glorious beacon of lightluxinterior is a glorious beacon of lightluxinterior is a glorious beacon of light
 



I'm sure you can find something over at hotscript.com but I'm just wondering about the legality of watermaking somebody elses pictures. Just something to consider.

Lux
luxinterior is offline  
Old 03-31-2005, 05:28 AM   #3 (permalink)
NamePros Regular
Join Date: Feb 2004
Location: Student @ UConn
Posts: 411
gamex has a spectacular aura aboutgamex has a spectacular aura about
 



I used something like this:

PHP Code:
$watermark "path/to/watermark/image.png";
$quality "80";
$imagedir "path/to/graphics/";

$workingdir opendir ($imagedir);
while (
$entry readdir($workingdir)) {
     if(
eregi(".+\.jpe?g$"$entry )) { 
         
$i=1;
    
watermark($imagedir."/".$entry$entry$watermark$quality);
    
$i++;
     } 
}

function 
watermark($srcfilename$newname$watermark$quality) {
$imageInfo getimagesize($srcfilename); 
$width $imageInfo[0]; 
$height $imageInfo[1]; 
$logoinfo getimagesize($watermark);
$logowidth $logoinfo[0];
$logoheight $logoinfo[1];
$horizextra =$width $logowidth;
$vertextra =$height $logoheight;
$horizmargin =  round($horizextra 2);
$vertmargin =  round($vertextra 2);
$photoImage ImageCreateFromJPEG($srcfilename);
????: NamePros.com http://www.namepros.com/programming/79125-watermark-on-upload.html
ImageAlphaBlending($photoImagetrue);
$logoImage ImageCreateFromPNG($watermark);
$logoW ImageSX($logoImage);
$logoH ImageSY($logoImage);
ImageCopy($photoImage$logoImage$horizmargin$vertmargin00$logoW$logoH);
????: NamePros.com http://www.namepros.com/showthread.php?t=79125
//ImageJPEG($photoImage); // output to browser
ImageJPEG($photoImage,"images/watermarked/wm_".$newname$quality); 
ImageDestroy($photoImage);
ImageDestroy($logoImage);

I used this code on my site a while ago. This code will actually add the water mark to all of the images in a directory. You can change the line of code that reads the directory to something that uploads the file.
__________________
Joe
gamex is offline  
Old 03-31-2005, 05:52 AM   #4 (permalink)
NamePros Expert
 
redhippo's Avatar
Join Date: Oct 2003
Location: ANForum
Posts: 5,218
redhippo is a splendid one to beholdredhippo is a splendid one to beholdredhippo is a splendid one to beholdredhippo is a splendid one to beholdredhippo is a splendid one to beholdredhippo is a splendid one to beholdredhippo is a splendid one to beholdredhippo is a splendid one to behold
 



great code Joe!
__________________
|www.vb-skins.com|- Quality Premade Vbulletin skins for Your VB forum makeover |www.Banjir.com|-Free image hosting?[B]For Sale!|AlphaScripts|Money Generating Scripts
FREE VB Skins
redhippo is offline  
Old 03-31-2005, 07:22 AM   #5 (permalink)
Account Closed
 
Mystic's Avatar
Join Date: Feb 2005
Location: England
Posts: 1,169
Mystic is just really niceMystic is just really niceMystic is just really niceMystic is just really nice
 



and about the legality of adding a watermark, put it in the terms and conditions
Mystic is offline  
Old 03-31-2005, 07:30 AM   #6 (permalink)
NamePros Regular
 
picobello's Avatar
Join Date: Dec 2004
Posts: 299
picobello is on a distinguished road
 



to avoid legal issues, you can just enlarge the image area and set the text just below the initial image area.

doing that, you do not alter the image content still having a trace of your own inside the image file !
picobello is offline  
Old 03-31-2005, 10:25 AM   #7 (permalink)
NamePros Regular
Join Date: Feb 2004
Location: Student @ UConn
Posts: 411
gamex has a spectacular aura aboutgamex has a spectacular aura about
 



Originally Posted by picobello
to avoid legal issues, you can just enlarge the image area and set the text just below the initial image area.

doing that, you do not alter the image content still having a trace of your own inside the image file !
Yea, thats a good idea too. This way you can be sure your watermark shows up. Otherwise if someone uploads a picture that is the same color as your watermark, it wont show up. There is a way around that, I just dont remember how off the top of my head.
__________________
Joe
gamex is offline  
Closed Thread


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools


Similar Threads
Thread Thread Starter Forum Replies Last Post
Let People Upload Files To My Web Site vector_anomaly Website Development 1 12-12-2004 08:18 AM
When you need to upload quick! GamingHybrid For Sale / Advertising Board 0 12-03-2004 01:28 AM
image upload failure redhippo Programming 3 11-18-2004 03:49 AM
file upload csmaster2005 Programming 8 06-18-2004 06:43 AM

Liquid Web Smart Servers  
All times are GMT -7. The time now is 02:10 AM.

Managed Web Hosting by Liquid Web
Domain name forum recommended by Domaining.com Powered by: vBulletin® Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.6.0 Ad Management plugin by RedTyger