src/Image.php
public function scale($width = null, $height = null)
    {
        if ($width === null && $height === null) {
            throw new \LogicException('one of "width" or "height" must be set for "scale"');
        }

        if ($width !== null && $height !== null) {
            $this->resize($width, $height);
            return;
        }

        if ($width !== null) {
            $this->image->widen($width);
            return;
        }

        $this->image->heighten($height);
    }
public function scale($width = null, $height = null)
    {
        if ($width === null && $height === null) {
            throw new \LogicException('one of "width" or "height" must be set for "scale"');
        }

        if ($width !== null && $height !== null) {
            $this->resize($width, $height);
            return;
        }

        if ($width !== null) {
            $this->image->widen($width);
            return;
        }

        $this->image->heighten($height);
    }
public function scale ( $ width = null , $ height = null ) { if ( $ width === null && $ height === null ) { throw new \ LogicException ( 'one of "width" or "height" must be set for "scale"' ) ; } if ( $ width !== null && $ height !== null ) { $ this -> resize ( $ width , $ height ) ; return ; } if ( $ width !== null ) { $ this -> image -> widen ( $ width ) ; return ; } $ this -> image -> heighten ( $ height ) ; }
Scales an image to the given width and height while maintaining aspect ratio.

The resulting image can be smaller for one or both target dimensions.

@param int $width
The target width, in pixels. This value is omitted then the scaling will
based only on the height value.
@param int $height
The target height, in pixels. This value is omitted then the scaling will
based only on the width value.
Scales an image to the given width and height while maintaining aspect ratio .