Skip to content

Commit

Permalink
Merge pull request #282 from PrabalPradhan1991/patch-3
Browse files Browse the repository at this point in the history
Update basic-usage.md
  • Loading branch information
freekmurze authored Dec 11, 2024
2 parents c3f6290 + 289c631 commit a151348
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions docs/usage/basic-usage.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,31 @@ weight: 1
Load an image by calling the static `load` method on the `Image` and passing in the `$pathToImage`.

```php
use Spatie\Image\Image;

$image = Image::load(string $pathToImage);
```


## Selecting a driver

By default, the Imagick driver will be used. However if you would like to use GD you can do this by selecting the driver before loading the image.

```php
use Spatie\Image\Image;

$image = Image::load($file)->useImageDriver('imagick'); // for imagick
$image = Image::load($file)->useImageDriver('gd'); // for gd
```


## Applying manipulations

Any of the [image manipulations](/image/v1/image-manipulations/overview) can be applied to the loaded `Image` by calling the manipulation's method. All image manipulation methods can be chained.

```php
use Spatie\Image\Image;

Image::load('example.jpg')
->sepia()
->blur(50)
Expand All @@ -29,6 +46,8 @@ Image::load('example.jpg')
Calling the `save` method on an `Image` will save the modifications to the original file. You can save your modified image by passing a `$outputPath` to the `save` method.

```php
use Spatie\Image\Image;

Image::load('example.jpg')
->width(50)
->save('modified-example.jpg');
Expand Down

0 comments on commit a151348

Please sign in to comment.