Skip to content

Commit

Permalink
Update crop docs.
Browse files Browse the repository at this point in the history
  • Loading branch information
timvandijck committed Nov 3, 2023
1 parent 9940f93 commit 549ba4c
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
1 change: 1 addition & 0 deletions UPGRADING.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,3 +25,4 @@ $image = Image::useImageDriver(ImageDriver::Imagick)->load('path/to/image.jpg');
- the `orientation` method now accepts a Orientation enum value.
- the `flip` method now accepts a FlipDirection enum value.
- the `fit` method now accepts a Fit enum value.
- the `crop` method now accepts a CropPosition enum value.
8 changes: 4 additions & 4 deletions docs/image-manipulations/resizing-images.md
Original file line number Diff line number Diff line change
Expand Up @@ -91,17 +91,17 @@ Image::load('example.jpg')
By calling the `crop` method part of the image will be cropped to the given `$width` and `$height` dimensions (pixels). Use the `$cropMethod` to specify which part will be cropped out.

```php
$image->crop(string $cropMethod, int $width, int $height);
$image->crop(int $width, int $height, CropPosition $position = CropPosition::Center);
```

The following `$cropMethod`s are available through constants of the `Manipulations` class:
`CROP_TOP_LEFT`, `CROP_TOP`, `CROP_TOP_RIGHT`, `CROP_LEFT`, `CROP_CENTER`, `CROP_RIGHT`, `CROP_BOTTOM_LEFT`, `CROP_BOTTOM`, `CROP_BOTTOM_RIGHT`.
The following `CropPosition`s are available on the enum:
`TopLeft`, `Top`, `TopRight`, `Left`, `Center`, `Right`, `BottomLeft`, `Bottom`, `BottomRight`.

### Example usage

```php
Image::load('example.jpg')
->crop(Manipulations::CROP_TOP_RIGHT, 250, 250)
->crop(250, 250, CropPosition::TopRight)
->save();
```

Expand Down

0 comments on commit 549ba4c

Please sign in to comment.