PHPackages                             salahmyn/laravel-image-resize - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Image &amp; Media](/categories/media)
4. /
5. salahmyn/laravel-image-resize

ActiveLibrary[Image &amp; Media](/categories/media)

salahmyn/laravel-image-resize
=============================

Dynamically resize an image and returns the URL using Intervention and Storage

v2.1.1(5y ago)091MITPHPPHP ^7.2

Since Oct 31Pushed 5y agoCompare

[ Source](https://github.com/salahmyn/laravel-image-resize)[ Packagist](https://packagist.org/packages/salahmyn/laravel-image-resize)[ Docs](https://github.com/salahmyn/laravel-image-resize)[ RSS](/packages/salahmyn-laravel-image-resize/feed)WikiDiscussions master Synced 2d ago

READMEChangelog (7)Dependencies (7)Versions (16)Used By (0)

Image Resize Helper for Laravel 5.x
===================================

[](#image-resize-helper-for-laravel-5x)

#### Fork from [MaximumAdvertising/laravel-image-resize](https://github.com/MaximumAdvertising/laravel-image-resize)

[](#fork-from-maximumadvertisinglaravel-image-resize)

Dynamically resize an image and returns the URL using Intervention and Storage

[![Latest Stable Version](https://camo.githubusercontent.com/274262befb5aee5389c2f1ebb6f717b95d1dcc2e92b86ef037e18be80e26d960/68747470733a2f2f706f7365722e707567782e6f72672f6d6178696d756d6164766572746973696e672f6c61726176656c2d696d6167652d726573697a652f762f737461626c65)](https://packagist.org/packages/maximumadvertising/laravel-image-resize)[![Latest Unstable Version](https://camo.githubusercontent.com/79bebb493809fc31b99dc544f2f389e85a7f799d690e22a80147cb48c1c98fbc/68747470733a2f2f706f7365722e707567782e6f72672f6d6178696d756d6164766572746973696e672f6c61726176656c2d696d6167652d726573697a652f762f756e737461626c65)](https://packagist.org/packages/maximumadvertising/laravel-image-resize)

Require
-------

[](#require)

- Laravel 5+
- Intervention Image ^2.4

Supported Filesystem Drivers
----------------------------

[](#supported-filesystem-drivers)

- Local
- S3
- Oss (Aliyun Cloud Storage)

Installation
------------

[](#installation)

This package can be installed through Composer.

```
composer require salahmyn/laravel-image-resize
```

For Laravel 5.4 and lower, you'll have to register the service provider and alias manually.

Add to service providers

```
Mxmm\ImageResize\ImageResizeServiceProvider::class,
```

And alias

```
'ImageResize' => Mxmm\ImageResize\Facade::class,
```

Publish config and assets (Optional)

```
php artisan vendor:publish --provider="Mxmm\ImageResize\ImageResizeServiceProvider"
```

Usage
-----

[](#usage)

Accepted parameters:

```
/**
 * @param string|null $path
 * @param int|null $width
 * @param int|null $height
 * @param string $action
 * @return string
 */
public static function url(string $path = null, int $width = null, int $height = null, string $action = 'fit' , $disk = null): string
```

In HTML:

```

```

Fit (resize &amp; crop) an image to 200x200px

```

```

Resize an image to 200x200px

```

```

Fit (resize &amp; crop) an image to 200px width, with auto height

```

```

Fit (resize &amp; crop) an image to 200px width, with auto height

```

```

sample output

```

```

### alias \[asset\]

[](#alias-asset)

an `assets` drive in config `filesystems` is required to use `asset` method which handle files in `public` directory

```
