src/Silvestra/Component/Media/Image/Resizer/ImageResizerHelper.php
public function getBoxSize(array $imageSize, array $size)
    {
        list($width, $height) = $size;

        if ((null == $width) && (null == $height)) {
            return $imageSize;
        }

        list($imageWidth, $imageHeight) = $imageSize;

        if ((null !== $width) && (null == $height)) {
            $height = ceil($width * ($imageHeight / $imageWidth));

            if ($height > $imageHeight) {
                $height = $imageHeight;
            }

            return array($width, $height);
        }

        if ((null === $width) && (null != $height)) {
            $width = ceil($height * ($imageWidth / $imageHeight));

            if ($width > $imageWidth) {
                $width = $imageWidth;
            }

            return array($width, $height);
        }

        return $size;
    }
public function getBoxSize(array $imageSize, array $size)
    {
        list($width, $height) = $size;

        if ((null == $width) && (null == $height)) {
            return $imageSize;
        }

        list($imageWidth, $imageHeight) = $imageSize;

        if ((null !== $width) && (null == $height)) {
            $height = ceil($width * ($imageHeight / $imageWidth));

            if ($height > $imageHeight) {
                $height = $imageHeight;
            }

            return array($width, $height);
        }

        if ((null === $width) && (null != $height)) {
            $width = ceil($height * ($imageWidth / $imageHeight));

            if ($width > $imageWidth) {
                $width = $imageWidth;
            }

            return array($width, $height);
        }

        return $size;
    }
public function getBoxSize ( array $ imageSize , array $ size ) { list ( $ width , $ height ) = $ size ; if ( ( null == $ width ) && ( null == $ height ) ) { return $ imageSize ; } list ( $ imageWidth , $ imageHeight ) = $ imageSize ; if ( ( null !== $ width ) && ( null == $ height ) ) { $ height = ceil ( $ width * ( $ imageHeight / $ imageWidth ) ) ; if ( $ height > $ imageHeight ) { $ height = $ imageHeight ; } return array ( $ width , $ height ) ; } if ( ( null === $ width ) && ( null != $ height ) ) { $ width = ceil ( $ height * ( $ imageWidth / $ imageHeight ) ) ; if ( $ width > $ imageWidth ) { $ width = $ imageWidth ; } return array ( $ width , $ height ) ; } return $ size ; }
Get box size.

@param array $imageSize
@param array $size

@return array
Get box size .