Source for file example_04.php

Documentation is available at example_04.php

  1. <?php
  2. /**
  3. * Resize Example #04
  4. *
  5. * This example shows the `fit` resize, which attempts to resize an image
  6. * (proportionally) only when it is bigger than a frame set by the provided width
  7. * and height - when it is do bigger, it is forced to "fit" inside that frame.
  8. *
  9. * @filesource
  10. * @package Asido.Examples
  11. * @subpackage Asido.Examples.Resize
  12. */
  13.  
  14. /////////////////////////////////////////////////////////////////////////////
  15.  
  16. /**
  17. * Include the main Asido class
  18. */
  19. include('./../../class.asido.php');
  20.  
  21. /**
  22. * Set the correct driver: this depends on your local environment
  23. */
  24. Asido::Driver('gd');
  25.  
  26. /**
  27. * Create an Asido_Image object and provide the name of the source
  28. * image, and the name with which you want to save the file
  29. */
  30. $i1 = Asido::Image('example.png', 'result_04_1.png');
  31. $i2 = Asido::Image('example.png', 'result_04_2.png');
  32.  
  33. /**
  34. * Resize the image by fitting it inside the 800x800 frame: in
  35. * fact it will not be resized because it is smaller
  36. */
  37. Asido::Fit($i1, 800, 800);
  38.  
  39. /**
  40. * Resize the image by fitting it inside the 400x400 frame: the image
  41. * will do be resized by making it fit inside the 400x400 "mold"
  42. */
  43. Asido::Fit($i2, 400, 400);
  44.  
  45. /**
  46. * Save the result
  47. */
  48. $i1->Save(ASIDO_OVERWRITE_ENABLED);
  49. $i2->Save(ASIDO_OVERWRITE_ENABLED);
  50.  
  51. /////////////////////////////////////////////////////////////////////////////
  52.  
  53. ?>

Documentation generated on Mon, 09 Apr 2007 23:57:11 +0300 by phpDocumentor 1.3.0RC4