Skip to content
Browse files

Merge pull request #1 from charlesgetup/cake-2.0

Awesome.
  • Loading branch information...
2 parents f456d12 + 9a57d47 commit e5b9982611b156d08bc2b20e2832063dbb457ce7 @arnold-almeida committed Apr 4, 2012
Showing with 5 additions and 3 deletions.
  1. +5 −3 Lib/mm/src/Media/Process/Image.php
View
8 Lib/mm/src/Media/Process/Image.php
@@ -143,11 +143,13 @@ public function zoomCrop($width, $height, $gravity = 'center') {
*
* @param integer $width
* @param integer $height
- * @param string $gravity Currently supported values are "center", "topleft",
+ * @param array $cropFrom manually define the crop area start point. Format: array(left,top).
+ * e.g. array(10,20) => crop at [left:10, top:20]
+ * @param string $gravity Currently supported values are "center", "topleft",
* "topright", "bottomleft", "bottomright", defaults to "center"
* @return boolean
*/
- public function fitCrop($width, $height, $gravity = 'center') {
+ public function fitCrop($width, $height, $gravity = 'center', $cropFrom = null) {
$rx = $this->_adapter->width() / $width;
$ry = $this->_adapter->height() / $height;
@@ -157,7 +159,7 @@ public function fitCrop($width, $height, $gravity = 'center') {
$resizeHeight = $this->_adapter->height() / $r;
$this->_adapter->resize($resizeWidth, $resizeHeight);
- list($left, $top) = $this->_boxify($width, $height, $gravity);
+ list($left, $top) = (is_array($cropFrom) && count($cropFrom) == 2) ? $cropFrom : $this->_boxify($width, $height, $gravity);
return $this->_adapter->crop($left, $top, $width, $height);
}

0 comments on commit e5b9982

Please sign in to comment.
Something went wrong with that request. Please try again.