It's not that hard, no imagemagick functions required! Use imagecopy (part of image functions, built into PHP GD stuff) and a nice 32 bit PNG image with the opacity exactly the way you like. Browse the PHP manual for more docs on the exact code, there are lots of examples. I found it didn't like to work until I specifically saved my file as a 32 bit PNG and specified opacity values for various elements I want to appear on top of the image. The opacity value (alpha channel) is fully respected by imagecopy under these circumstances, so it composites the two images just like it would in any good graphics app, leaving you with a single image.

Similarly, you can use imagecopyresampled, also part PHP, to create smaller files. Using imagejpeg you can output the resized jpegs. It's not terribly hard, either.

I use all this on my site. It works like a charm for watermarking my images on my photo website I'm developing. I do it on the fly and let registered users select their level of compression (jpeg low to high, even png) and compress images on the fly. I can even let certain users view my preview-sized (640x480) photos without a watermark, and I can do this because I add the watermark in real time. For a not terribly busy website and when not overused, it works great. Beware it can get a bit slow and/or memory intensive if you are working with it a lot or with large files in a real-world site environment. However, my host's lightly loaded, dual 3 GHz linux boxes with 1.5 GB of RAM make this almost a moot issue. :)

-Galen


On Dec 9, 2003, at 5:14 PM, Al wrote:


There's a command line, open-source utility called ImageMagick
(http://www.imagemagick.org/) available for all major platforms that allows
you to do lots of powerful image manipulation on one file, or one thousand.
You crop, scale, rotate, colour, draw on, place text over, compose,
transform and create montages of images using this program.


It has quite a steep learning curve, but the results are worth it!

You can run this using PHP shell_exec() function if you want to execute the
program from a web page, although be careful of the obvious security
consideration involved in doing this.


Hope it helps,

Al


"Ryan A" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED]
Hi,
This was asked some time ago but cant find it in the archive, anybody
remember how it was solved please write and tell me.

Requirment:
Write domain name in faint color on picture (a kind of "watermark")

Reason:
I have 3 directories full of images that are original to our site and I
spent a crapload of time scanning them and putting them up, I dont want
others to just "borrow" the images and use them without giving us some
type
of credit...

I found a package on google after searching that you just throw all the
images in a folder and it generates the thumbs for you in a folder called
"thumbs", can i do the same for this too?
ie.
throw all the images in a folder, run the program and get www.sitename.com
written on all the images?


Any help and reminders appreciated.

Cheers,
-Ryan

-- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php




-- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php



Reply via email to