yeah not bad prog but i used VidLogo and it was more comfy i think and more simple.
btw its not only my opinion.
i did my work very fast without troubles:)
i adcvic VL to all
GLuck and Marry Xmas:))
| SitePoint Sponsor |
yeah not bad prog but i used VidLogo and it was more comfy i think and more simple.
btw its not only my opinion.
i did my work very fast without troubles:)
i adcvic VL to all
GLuck and Marry Xmas:))
Something wrong... I got the image but without watermark. What coul'd be wrong?
Why the line
$image = imagecreatetruecolor($watermark_width, $watermark_height);
Also, imagecopymerge() won't preserve transparency (a bug of this function maybe). Use imagecopy() if the watermark.png has an alpha channel that you'd like to preserve.
hello
I can not understand english good
so how can I download the file and
upload it to my images folder
please,I want the file ready
Yes, like uweb said, if you want to use a png24 simply replace imagecopymerge($image, $watermark, $dest_x, $dest_y, 0, 0, $watermark_width, $watermark_height, 100); with imagecopy($image, $watermark, $dest_x, $dest_y, 0, 0, $watermark_width, $watermark_height);
I could not preserve the transparency when I was attaching a watermark and the reason was that when using imagecopy you should use the image height not the window height. eg. imagecopy($image, $watermark, $dest_x, $dest_y, 0, 0, $image_width, $image_height)
Whoops, when I said window height for my previous comment, I meant watermark height. So basically when using imagecopy to keep transparency I used the image width and height, instead of the watermark width and height as the last two parameters. I really don't understand why this works, as opposed to using the watermark dimensions, but it does, otherwise it would copy it with a black background.
Great script
I usually use programm to resize my pictures,then upload the pictures to my host!Batch Watermark Creator is a good choice,That's the one I know how to use.visit the on-line places and search it;
Good one but the next time you put something like this up, don't fail to put up a sample. It helps. Thank a lot





What do others here use for auto watermarking images ?
@ Jellen: the point of this tutorial is not to teach people how to use a software but how to watermark a picture using PHP. Your software can not watermark if a picture is uploaded to a site by a third party or the site owner. Here doesn't matter how the picture get there it will be watermarked
@ Prince Blessing Sunday: A sample for a 13 lines code is pretty much useless, if one can not be bothered to copy paste the above and create 2 images to test it out then one should really considering quiting development lol
@ Dez: this is a vague question, you have software and other development language, in PHP there isn't 100 ways of doing it.
@ the author: well done, nice, easy and to the point :)
Works great. Thanks for the tutorial.





@ Gilles : Not entirely vague - just wondering if the other members here use other coding ways in PHP for doing this.
how to execute this in browser??
<img src="yourscript.php?src=blabla.jpg"/>
this is exactly what i need... except one little thing, actually two.
frist of all THANK YOU SO MUCH for this code.
i need my watermark to be aligned top, right and not tile- my png is going to be just SMALL 150x40px image and i wanted it to be bottom->right without tile, if you can helo i would appreciate alot, thanks!
VidLogo is good, that's enough for me...
Have a good day, guys!!!
Anyone got problems with some jpg-files? I get error message on some jpg-files: Warning: imagecopymerge(): supplied argument is not a valid Image resource in
Found this great Online Watermark Tool. It gives you a ton of options to customize your watermark.
Armin
Online Games - Play Free Online Games
Arcade Games - Tons of Arcade Games
Watermark Tool - Protect your Photos




This code is good for generating the image, but if you plan to use it in production, you need to add some caching to it.
Either cache the image data to a file/database, and server it if it's already generated, or cache it in some proxy server or something (no code changes, but needs that server).
Generating the water mark for every image on your site on the fly will be really slow when you have a bit of traffic or pages with allot of images (gallery style).
Just got to say that I spent near enough 9 hours of looking around the net last night and trying many, MANY different tutorials but not one worked... until I downloaded yours that is. All I got was the white box with the little red x inside mocking me or error messages that didn't make a lot of sense to me.
BUT YOURS WORKED FIRST TIME.
I just decided to have one more go and found yours thank god... now I can sleeeeeep.
Mr Ferguson you deserve an attaboy for putting together a tutorial that is simple, easy to understand and actually WORKS.
THANK YOU.
NeoMorph
Hi Guys,
Just wanted to thank all of you for the kind comments regarding this tutorial. It's very cool to see that it's still getting activity 4 years after it's post. I'll have to think of something else to write about, now![]()
Brock Ferguson
Lead Developer, Caribou CMS
A Subscription/Membership CMS and Ecommerce Platform - FREE Trial
Bookmarks