Watermark Gravity
This example demonstrates how to use the watermark gravity. There are nine locations at which you can put the watermark (except when using the tile watermark), and this example puts a watermark on every one of these locations.
<?php /** * Include the main Asido class */ include('./../../class.asido.php'); /** * Set the correct driver: this depends on your local environment */ asido::driver('gd'); /** * Create an Asido_Image object and provide the name of the source * image, and the name with which you want to save the file */ $i1 = asido::image('example.jpg', 'result_01.jpg'); /** * Put a watermark image on every possible gravity location */ $watermark = 'watermark_01.png'; Asido::watermark($i1, $watermark, ASIDO_WATERMARK_TOP_LEFT); Asido::watermark($i1, $watermark, ASIDO_WATERMARK_TOP_CENTER); Asido::watermark($i1, $watermark, ASIDO_WATERMARK_TOP_RIGHT); Asido::watermark($i1, $watermark, ASIDO_WATERMARK_MIDDLE_LEFT); Asido::watermark($i1, $watermark, ASIDO_WATERMARK_MIDDLE_CENTER); Asido::watermark($i1, $watermark, ASIDO_WATERMARK_MIDDLE_RIGHT); Asido::watermark($i1, $watermark, ASIDO_WATERMARK_BOTTOM_LEFT); Asido::watermark($i1, $watermark, ASIDO_WATERMARK_BOTTOM_CENTER); Asido::watermark($i1, $watermark, ASIDO_WATERMARK_BOTTOM_RIGHT); /** * Save the result */ $i1->save(ASIDO_OVERWRITE_ENABLED); ?>
Here you can see the source image, the watermark image, and the result:
You can download the source for this example from here:
http://www.asido.info/examples/watermark/example_01.phps




October 10th, 2007 at 8:27 pm
hi!
how i can i integrate it with my file upload?
I want to upload files then process it with Asido..
I seem have a difficulty knowing the image source if it’s not yet uploaded…
thanks!
October 11th, 2007 at 1:13 am
Hi,
you wrote ti yourself - “…upload files then process it with Asido…” - so you first have to be sure the files are uploaded to the server and that they are available, and then process them with Asido as with any other image you have access to on the server.
October 11th, 2007 at 2:26 am
thanks!!!
more power! I going to use it in all of my applications that uses image manipulation!
February 12th, 2008 at 12:37 pm
Was wondering if there was a way to use Asido to add user inputted text to an existing image at predefined locations?
February 14th, 2008 at 8:43 am
@Rewt: currently, Asido does not support such features.
April 1st, 2008 at 11:35 am
What is the best way to display the results of an asido object? I see a method called “__write()”, but using it like
“@image->__write();” generates an error….
April 3rd, 2008 at 1:25 pm
__write() is a private(protected) method and it can not be used outside the boundaries of the class; if you want to see the results you have to save the asido_image by calling asido_image::save()