| 1 | <?php |
|---|
| 2 | |
|---|
| 3 | /** |
|---|
| 4 | * Takes a source filename, and allow for editing |
|---|
| 5 | * |
|---|
| 6 | * Provides abstraction for common image manipulation functions |
|---|
| 7 | * |
|---|
| 8 | * @since 3.5 |
|---|
| 9 | */ |
|---|
| 10 | interface WP_Image_Editor { |
|---|
| 11 | /** |
|---|
| 12 | * Initialize Image for editing |
|---|
| 13 | * |
|---|
| 14 | * @param string $file_path Filename to prepare for edit |
|---|
| 15 | * @param bool $stream Output as stream, rather than to a file |
|---|
| 16 | */ |
|---|
| 17 | function __construct( $file_path, $stream = false ); |
|---|
| 18 | |
|---|
| 19 | /** |
|---|
| 20 | * Resizes Image. |
|---|
| 21 | * |
|---|
| 22 | * Saves to self by default; otherwise saves to $output_file |
|---|
| 23 | * |
|---|
| 24 | * @since 3.5 |
|---|
| 25 | * |
|---|
| 26 | * @param int $width Width of Image Output |
|---|
| 27 | * @param int $height Height of Image Output |
|---|
| 28 | * @param string $output_file Path to file location to save |
|---|
| 29 | * @return bool true or stream if succeeded, false otherwise. |
|---|
| 30 | */ |
|---|
| 31 | public function resize( $width, $height, $output_file = null, $output_quality = 90 ); |
|---|
| 32 | |
|---|
| 33 | /** |
|---|
| 34 | * Rotates Image. |
|---|
| 35 | * |
|---|
| 36 | * Saves to self by default; otherwise saves to $output_file |
|---|
| 37 | * |
|---|
| 38 | * @since 3.5 |
|---|
| 39 | * |
|---|
| 40 | * @param int $angle Positive or negative angle of rotation |
|---|
| 41 | * @param string $output_file Path to file location to save |
|---|
| 42 | * @return bool true or stream if succeeded, false otherwise. |
|---|
| 43 | */ |
|---|
| 44 | public function rotate( $angle, $output_file = null ); |
|---|
| 45 | |
|---|
| 46 | /** |
|---|
| 47 | * Crops Image. |
|---|
| 48 | * |
|---|
| 49 | * Saves to self by default; otherwise saves to $output_file |
|---|
| 50 | * |
|---|
| 51 | * @since 3.5 |
|---|
| 52 | * @param int dst_x x-coordinate of destination point. |
|---|
| 53 | * @param int $dst_y y-coordinate of destination point. |
|---|
| 54 | * @param int $src_x y-coordinate of destination point. |
|---|
| 55 | * @param int $src_y y-coordinate of source point. |
|---|
| 56 | * @param int $dst_w Destination width. |
|---|
| 57 | * @param int $dst_h Destination height. |
|---|
| 58 | * @param int $src_w Source width. |
|---|
| 59 | * @param int $src_h Source height. |
|---|
| 60 | * @param string $output_file Path to file location to save |
|---|
| 61 | * @return bool true or stream if succeeded, false otherwise. |
|---|
| 62 | */ |
|---|
| 63 | public function crop( $dst_y, $src_x, $src_y, $dst_w, $dst_h, $src_w, $src_h, $output_file = null, $output_quality = 90 ); |
|---|
| 64 | |
|---|
| 65 | /** |
|---|
| 66 | * Checks to see if $mime_type is supported by image editor class |
|---|
| 67 | * |
|---|
| 68 | * @since 3.5 |
|---|
| 69 | * |
|---|
| 70 | * @param string mime-type of image to check |
|---|
| 71 | * @return true if type is supported by class, and false otherwise |
|---|
| 72 | */ |
|---|
| 73 | public function is_supported( $mime_type ); |
|---|
| 74 | } |
|---|
| 75 | |
|---|
| 76 | ?> |
|---|