Sulu\Bundle\MediaBundle\Media\ImageConverter\Cropper\Cropper::isInsideImage PHP Method

isInsideImage() private method

Returns true iff the cropping does not exceed the image borders.
private isInsideImage ( Imagine\Image\ImageInterface $image, $x, $y, $width, $height ) : boolean
$image Imagine\Image\ImageInterface
$x
$y
$width
$height
return boolean
    private function isInsideImage(ImageInterface $image, $x, $y, $width, $height)
    {
        if ($x < 0 || $y < 0) {
            return false;
        }
        if ($x + $width > $image->getSize()->getWidth()) {
            return false;
        }
        if ($y + $height > $image->getSize()->getHeight()) {
            return false;
        }
        return true;
    }