Watermark Scaling w/ Scaling Factor
There are situations in which it turns out that the watermark image is considerable larger compared to the image that is going to be watermarked. In these scenarios Asido applies watermark scaling. This means that the watermark is resized so its dimensions become some portion of the image that is going to be watermarked. This feature can be turned on and off by using the ASIDO_WATERMARK_SCALABLE_ENABLED and ASIDO_WATERMARK_SCALABLE_DISABLED constants. By default, the featured is enabled, and the scaling factor is taken from the ASIDO_WATERMARK_SCALABLE_FACTOR constant. If you want you can re-define this constant, or just provide a decimal value (0 < scaling_factor < 1) instead. By default, the scaling factor is 0.25 (1/4).
<?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_04.jpg'); /** * Put the watermark with the scaling factor 0.66 */ Asido::watermark($i1, 'watermark_04.png', ASIDO_WATERMARK_TOP_LEFT, ASIDO_WATERMARK_SCALABLE_ENABLED, 0.66); /** * Put the watermark with the scaling factor 0.75 */ Asido::watermark($i1, 'watermark_04.png', ASIDO_WATERMARK_BOTTOM_RIGHT, ASIDO_WATERMARK_SCALABLE_ENABLED, 0.75); /** * 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_04.phps



October 26th, 2007 at 9:49 am
i got an error.. while making those sample.
Warning: Call-time pass-by-reference has been deprecated; If you would like to pass it by reference, modify the declaration of [runtime function name](). If you would like to enable call-time pass-by-reference, you can set allow_call_time_pass_reference to true in your INI file.
class.driver.php on line 239
class.driver.php on line 545
class.driver.php on line 556
it works on my local machine.. but not on my server. since i dont have access to the php.ini
any help please?
thanks!
October 26th, 2007 at 12:40 pm
I guess you are using PHP5, right ?
October 27th, 2007 at 9:19 am
yup! I am using PHP 5 in my server and I am using php 4 in my localhost… oh.. i didn’t know that they are using php 5 until you replied!
any ideas? I looked in the documentation but can’t seem to find one.
thanks!
October 27th, 2007 at 9:24 am
The issues are due to the stricter error reporting rules available in PHP5, which are obviously enabled on your hosting. One way to hide those warnings is to alter the error reporting setting on your hosting.
Since the Asido involvement in the GoPHP5 project, there will be a php5-only release soon, which will have all these warnings and notices fixed.
May 26th, 2008 at 6:50 pm
Yeah I got the same problem and Ive Dreamhost Hosting running PHP5, any ideas??