PHPackages                             emil-zhivkov/image-resizer - 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. emil-zhivkov/image-resizer

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

emil-zhivkov/image-resizer
==========================

resize images and keep aspect ration

09PHP

Since Dec 11Pushed 7y ago1 watchersCompare

[ Source](https://github.com/emil-zhivkov/image-resizer)[ Packagist](https://packagist.org/packages/emil-zhivkov/image-resizer)[ RSS](/packages/emil-zhivkov-image-resizer/feed)WikiDiscussions master Synced today

READMEChangelogDependenciesVersions (1)Used By (0)

image-resizer
=============

[](#image-resizer)

resize existing images on server and save it in custom directory. You can use them later only with calling model property

This version works onli with photos stored in public directory

Install package
---------------

[](#install-package)

```
composer require emil-zhivkov/image-resizer @dev

```

config/app.php

```
 EmilZhivkov\ImageResizer\ImageResizerServiceProvider::class,
```

Publishing configuration file
-----------------------------

[](#publishing-configuration-file)

```
php artisan vendor:publish
```

Configuration file config/image-resizer.php
-------------------------------------------

[](#configuration-file-configimage-resizerphp)

Section 1

if you store in your database only filename you must define public path to your photo directory Example: image field: avatar.jpg 'images\_base\_path' =&gt; 'public\_path\_to\_image\_directory',

Or image field: images/users/avatar.jpg

'images\_base\_path' =&gt; '/'

Section 2

You can change image sizes here. Aspect ratio keep the same as original photo You can define sizes here. And you can add you own type of size but must to extend ImageTrait and add new mutator there.

Define model image property here Example

'User' =&gt; 'avatar',

'Article' =&gt; 'featured\_image',

'Product' =&gt; 'image'

etc.

Section 3 define public path to your fallback images.

\##Usage Exmple:

```
