src/Manipulators/Size.php
public function resolveMissingDimensions(Image $image, $width, $height)
    {
        if (is_null($width) and is_null($height)) {
            $width = $image->width();
            $height = $image->height();
        }

        if (is_null($width)) {
            $width = $height * ($image->width() / $image->height());
        }

        if (is_null($height)) {
            $height = $width / ($image->width() / $image->height());
        }

        return [
            (int) $width,
            (int) $height,
        ];
    }
public function resolveMissingDimensions(Image $image, $width, $height)
    {
        if (is_null($width) and is_null($height)) {
            $width = $image->width();
            $height = $image->height();
        }

        if (is_null($width)) {
            $width = $height * ($image->width() / $image->height());
        }

        if (is_null($height)) {
            $height = $width / ($image->width() / $image->height());
        }

        return [
            (int) $width,
            (int) $height,
        ];
    }
public function resolveMissingDimensions ( Image $ image , $ width , $ height ) { if ( is_null ( $ width ) and is_null ( $ height ) ) { $ width = $ image -> width ( ) ; $ height = $ image -> height ( ) ; } if ( is_null ( $ width ) ) { $ width = $ height * ( $ image -> width ( ) / $ image -> height ( ) ) ; } if ( is_null ( $ height ) ) { $ height = $ width / ( $ image -> width ( ) / $ image -> height ( ) ) ; } return [ ( int ) $ width , ( int ) $ height , ] ; }
Resolve missing image dimensions.
@param  Image        $image  The source image.
@param  integer|null $width  The image width.
@param  integer|null $height The image height.
@return integer[]    The resolved width and height.
Resolve missing image dimensions .