contributions/lib.imagetools/lib/interfaces/iimagetools.cls.php
Go to the documentation of this file.00001 <?php 00002 /** 00003 * Interface for image tool delegations 00004 * 00005 * Uses either gd or imagick extension, if installed. imagick is preferred 00006 * 00007 * @author Gerd Riesselmann 00008 * @ingroup ImageTools 00009 */ 00010 interface IImageTools { 00011 /** 00012 * Create an IImageInformation from a file 00013 * 00014 * @return IImageInformation False on failure 00015 */ 00016 public function create_from_file($file); 00017 00018 /** 00019 * Create an IImageInformation from a file 00020 * 00021 * @return IImageInformation False on failure 00022 */ 00023 public function create_from_binary_data($data); 00024 00025 /** 00026 * Resize given image. Image is streched to fit 00027 * 00028 * @return IImageInformation False on failure 00029 */ 00030 public function resize(IImageInformation $src, $width, $height); 00031 00032 /** 00033 * Resize given image. Image is not streched, so ratio is not changed. 00034 * 00035 * Resizing an image of 200 x 100 to 100 x 100 will result in a image of size 100 x 50 00036 * 00037 * @return IImageInformation False on failure 00038 */ 00039 public function resize_fit(IImageInformation $src, $width, $height); 00040 00041 /** 00042 * Cuts portion of image 00043 * 00044 * @return IImageInformation 00045 */ 00046 public function crop(IImageInformation $src, $x, $y, $width, $height); 00047 00048 /** 00049 * Fit image in given height and width. If image is larger than given size, it 00050 * will be downsampled. If it is smaller, it will be untouched. Ratio is not changed. 00051 * Background is filled with $backgroundcolor 00052 * 00053 * @return IImageInformation False on failure 00054 */ 00055 public function fit(IImageInformation $src, $width, $height, $backgroundcolor = 0xFFFFFF); 00056 00057 /** 00058 * Add a Watermark 00059 * 00060 * @param IImageInformation $src Image to add watermark to 00061 * @param string $text Text of Watermark, if emtpy "© {Application Title}" is taken 00062 * 00063 * @return IImageInformation 00064 */ 00065 public function watermark(IImageInformation $src, $text = false); 00066 00067 /** 00068 * Rotate image 00069 * 00070 * @param IImageInformation $src Image to rotate 00071 * @param float $degrees Degrees to rotate (0-360) 00072 * @param int $backgroundcolor Backgroundcolor of new portions 00073 * @return IImageInformation False on failure 00074 */ 00075 public function rotate(IImageInformation $src, $degrees, $backgroundcolor = 0xFFFFFF); 00076 }