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:

 Source Image  Watermark  Result

You can download the source for this example from here:
http://www.asido.info/examples/watermark/example_01.phps

8 Responses to “Watermark Gravity”

  1. garfic Says:

    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!

  2. admin Says:

    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.

  3. garfic Says:

    thanks!!!

    more power! I going to use it in all of my applications that uses image manipulation!

  4. Rewt Says:

    Was wondering if there was a way to use Asido to add user inputted text to an existing image at predefined locations?

  5. admin Says:

    @Rewt: currently, Asido does not support such features.

  6. KenW Says:

    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….

  7. admin Says:

    __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()

  8. Vernon Casares Says:

    Tired of getting low numbers of useless visitors for your website? Well i want to share with you a fresh underground tactic that makes me personally $900 daily on 100% AUTOPILOT. I really could be here all day and going into detail but why dont you merely check their website out? There is a great video that explains everything. So if your seriously interested in producing simple cash this is the site for you. Auto Traffic Avalanche

Leave a Reply

Powered by WordPress
Asido: PHP Image Processing Solution