MediaAdmin/FileUtils/Image/ImagickImageManager.php
protected function resizeImage(array $format, Imagick $image)
    {
        $maxWidth = array_key_exists('max_width', $format)? $format['max_width']: $this->maxWidth;
        $maxHeight = array_key_exists('max_height', $format)? $format['max_height']: $this->maxHeight;
        if ($maxWidth > $this->maxWidth) {
            $maxWidth = $this->maxWidth;
        }
        if ($maxHeight > $this->maxHeight) {
            $maxHeight = $this->maxHeight;
        }

        $image->setimagebackgroundcolor('#000000');
        $image->resizeImage($maxWidth, $maxHeight, Imagick::FILTER_LANCZOS, 1, true);

        return $image;
    }
protected function resizeImage(array $format, Imagick $image)
    {
        $maxWidth = array_key_exists('max_width', $format)? $format['max_width']: $this->maxWidth;
        $maxHeight = array_key_exists('max_height', $format)? $format['max_height']: $this->maxHeight;
        if ($maxWidth > $this->maxWidth) {
            $maxWidth = $this->maxWidth;
        }
        if ($maxHeight > $this->maxHeight) {
            $maxHeight = $this->maxHeight;
        }

        $image->setimagebackgroundcolor('#000000');
        $image->resizeImage($maxWidth, $maxHeight, Imagick::FILTER_LANCZOS, 1, true);

        return $image;
    }
protected function resizeImage ( array $ format , Imagick $ image ) { $ maxWidth = array_key_exists ( 'max_width' , $ format ) ? $ format [ 'max_width' ] : $ this -> maxWidth ; $ maxHeight = array_key_exists ( 'max_height' , $ format ) ? $ format [ 'max_height' ] : $ this -> maxHeight ; if ( $ maxWidth > $ this -> maxWidth ) { $ maxWidth = $ this -> maxWidth ; } if ( $ maxHeight > $ this -> maxHeight ) { $ maxHeight = $ this -> maxHeight ; } $ image -> setimagebackgroundcolor ( '#000000' ) ; $ image -> resizeImage ( $ maxWidth , $ maxHeight , Imagick :: FILTER_LANCZOS , 1 , true ) ; return $ image ; }
Resize an image keeping its ratio

@param array   $format
@param Imagick $image

@return Imagick
Resize an image keeping its ratio