src/Manipulators/Crop.php
public function limitToImageBoundaries(Image $image, array $coordinates)
    {
        if ($coordinates[0] > ($image->width() - $coordinates[2])) {
            $coordinates[0] = $image->width() - $coordinates[2];
        }

        if ($coordinates[1] > ($image->height() - $coordinates[3])) {
            $coordinates[1] = $image->height() - $coordinates[3];
        }

        return $coordinates;
    }
public function limitToImageBoundaries(Image $image, array $coordinates)
    {
        if ($coordinates[0] > ($image->width() - $coordinates[2])) {
            $coordinates[0] = $image->width() - $coordinates[2];
        }

        if ($coordinates[1] > ($image->height() - $coordinates[3])) {
            $coordinates[1] = $image->height() - $coordinates[3];
        }

        return $coordinates;
    }
public function limitToImageBoundaries ( Image $ image , array $ coordinates ) { if ( $ coordinates [ 0 ] > ( $ image -> width ( ) - $ coordinates [ 2 ] ) ) { $ coordinates [ 0 ] = $ image -> width ( ) - $ coordinates [ 2 ] ; } if ( $ coordinates [ 1 ] > ( $ image -> height ( ) - $ coordinates [ 3 ] ) ) { $ coordinates [ 1 ] = $ image -> height ( ) - $ coordinates [ 3 ] ; } return $ coordinates ; }
Limit coordinates to image boundaries.
@param  Image $image       The source image.
@param  int[] $coordinates The coordinates.
@return int[] The limited coordinates.
Limit coordinates to image boundaries .