PHPackages                             smallunit/image - 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. smallunit/image

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

smallunit/image
===============

image resize height ,width and quality

v1.0.2(9y ago)218MITPHP

Since Aug 25Pushed 9y ago1 watchersCompare

[ Source](https://github.com/Gami-404/imageresize)[ Packagist](https://packagist.org/packages/smallunit/image)[ RSS](/packages/smallunit-image/feed)WikiDiscussions master Synced today

READMEChangelogDependenciesVersions (3)Used By (0)

Small units
===========

[](#small-units)

Small units can use in many apps this has one purpose is resize the image. add this very faster unit because this work in any service provider and very spacial is not take time in autoload

Contributing
------------

[](#contributing)

Thank you for considering contributing to the smallUnit component! The contribution guide can be found in the [Laravel documentation](http://laravel.com/docs/contributions).

Security Vulnerabilities
------------------------

[](#security-vulnerabilities)

If you discover a security vulnerability within smallUnit, please send an e-mail to Taylor Otwell at abdo.gamy2010@gmail.com . All security vulnerabilities will be promptly addressed.

License
-------

[](#license)

The smallunit framework is open-sourced software licensed under the [MIT license](http://opensource.org/licenses/MIT). ##Documentation ###First Download using composer ...

```
composer require smallunit/image

```

\###next bind the class by using any service provider active in laravel,as app/Providers/AppServiceProvider.php path is created by laravel copy

```
$this->app->bind("image", function () {
            return new Image(config('config_file_name.versions'));
        });

```

in AppServiceProvider@boot method. \[config\_file\_name\] you can config you versions in any file you want or create you own config file in \[project\_name/config/myconfigFile\] ,\[versions\] is key of array of version you can change it. ###Final add Facade alias in config/app.php

```
  'Image'=> Image\Facades\Image::class,

```

\###Configuration add in you file which you define in Your service provider this structure

```
       |--------------------------------------------------------------------------
       | Image versions
       |--------------------------------------------------------------------------
       | Defining your standard versions 's information for image  which you
       | resize. it is very easy way and very simple code to resize image
       */

     'versions' => [
           'Profile'=>[// version name
               'height'=>'150',
               'width'=>'200',
               'quality'=>'100',//quality of new version
               'suffix'=>'profile',//suffix of version
               'path'=>''//form public path in laravel project
           ],
           //another version
           'Icons-posts'=>[
               'height'=>'75',
               'width'=>'75',
               'quality'=>'50',
               'suffix'=>'icons',
               'path'=>'src/img/posts/'
           ]
       ],

```

\##Functions

```
/**
     * add runtime versions
     * @param $version
 */
Image::addVersion($versionArray)
 /**
     * Make all version  for image
     * @param $originalPath > the path of originalPath
     */
Image::makeAllVersions($originalPath)
    /**
     * Make version which his name $versionName
     * @param $versionName
     * @param $originalPath
     */
Image::makeVersion($versionName, $originalPath)
**
     * @param $versionName
     * @param $originalPath
     * @return string path of the version will be created or been created
     */
Image::getVersionPath($versionName, $originalPath)
 /**
     * return the suffix of version
     * @param $versionName
     * @return mixed
 */
Image::suffix($versionName)

```

\##Example Apply this docs

```
