Skip to content

Commit

Permalink
cleaner handling of cropZoom
Browse files Browse the repository at this point in the history
Signed-off-by: Andy Miller <rhuk@mac.com>
  • Loading branch information
rhukster committed Jun 4, 2020
1 parent 3bd4f94 commit aaa636f
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions system/src/Grav/Common/Page/Medium/ImageMedium.php
Original file line number Diff line number Diff line change
Expand Up @@ -516,6 +516,15 @@ public function height($value = 'auto')
return $this;
}

/**
* Handle this commonly used variant
*/
public function cropZoom()
{
$this->__call('zoomCrop', func_get_args());
return $this;
}

/**
* Forward the call to the image processing method.
*
Expand All @@ -525,10 +534,6 @@ public function height($value = 'auto')
*/
public function __call($method, $args)
{
if ($method === 'cropZoom') {
$method = 'zoomCrop';
}

if (!\in_array($method, self::$magic_actions, true)) {
return parent::__call($method, $args);
}
Expand Down

0 comments on commit aaa636f

Please sign in to comment.