[PATCH] Image_Transform IM driver crop() implementation
| From: | Ian Eure | Date: | Thu, 27 Nov 2003 01:14:16 +0000 |
| Subject: | [PATCH] Image_Transform IM driver crop() implementation | ||
| Groups: | php.pear.dev | ||
| Request: | Send a blank email to pear-dev+get-23896@lists.php.net to get a copy of this message | ||
While working with Image_Transform, I noticed that none of the drivers had a
crop() implementation. I needed one for IM, so I wrote it, and here it is.
--- Image/Transform/Driver/IM.php.orig Sat Nov 1 21:30:06 2003
+++ Image/Transform/Driver/IM.php Wed Nov 26 17:08:41 2003
@@ -195,5 +195,21 @@
return true;
}
+ /**
+ * Crop image
+ *
+ * @author Ian Eure <ieure@websprockets.com>
+ *
+ * @param int height Cropped image height
+ * @param int width Cropped image width
+ * @param int x X-coordinate to crop at
+ * @param int y Y-coordinate to crop at
+ *
+ * @return none
+ */
+ function crop($height, $width, $x = 0, $y = 0) {
+ $this->command['crop'] = "-crop {$width}x{$height}+{$x}+{$y}";
+ }
+
} // End class ImageIM
?>