PHPackages                             alfiandri/imageupload - 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. [File &amp; Storage](/categories/file-storage)
4. /
5. alfiandri/imageupload

ActiveLibrary[File &amp; Storage](/categories/file-storage)

alfiandri/imageupload
=====================

Upload image using Laravel's build in function and resize it automatically. Duplicate from Muhammad Zamroni.

v9.1.1(1y ago)228MITPHPPHP &gt;=5.5.9

Since Jun 13Pushed 1y agoCompare

[ Source](https://github.com/alfiandri/laravel-imageupload)[ Packagist](https://packagist.org/packages/alfiandri/imageupload)[ RSS](/packages/alfiandri-imageupload/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (4)Dependencies (6)Versions (22)Used By (0)

Laravel Imageupload
===================

[](#laravel-imageupload)

[![Build Status](https://camo.githubusercontent.com/ebfb054836905560ae82099c1e75036a225195e8cc70ed51ab1c74edce386dec/68747470733a2f2f7472617669732d63692e6f72672f6d617472697068652f6c61726176656c2d696d61676575706c6f61642e7376673f6272616e63683d6d6173746572)](https://travis-ci.org/matriphe/laravel-imageupload)[![Total Download](https://camo.githubusercontent.com/8ac6ac8d2684152a6af60a2bed27d045ed689f2d0947dfea8c011da618bdf362/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f6d617472697068652f696d61676575706c6f61642e737667)](https://packagist.org/packages/matriphe/imageupload)[![Latest Stable Version](https://camo.githubusercontent.com/ba3f5e499113238b70fce57967db63812da9c4e21bcc90142e5bd12511b8071a/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f6d617472697068652f696d61676575706c6f61642e737667)](https://packagist.org/packages/matriphe/imageupload)

Upload image easily using Laravel's build in function and resize it automatically.

---

- [Version Compatibility](#version-compatibility)
- [Installation](#installation)
    - [Laravel 5.0, 5.1, 5.2, 5.3, and 5.4](#laravel-50-51-52-53-and-54)
    - [Laravel 5.5](#laravel-55)
- [Publish Configuration and Migration File](#publish-configuration-and-migration-file)
    - [Configuration](#configuration)
    - [Migration](#migration)
    - [Model](#model)
- [Try Upload Something!](#try-upload-something)
    - [Route Example](#route-example)
    - [View](#view)
- [Usage](#usage)
    - [Set Output](#set-output)
    - [Example](#example)
    - [Output Example](#output-example)
        - [JSON](#json)
        - [Array](#array)
        - [Collection](#collection)
        - [ImageuploadModel](#imageuploadmodel)
- [Changelog](#changelog)
    - [Version 6.1](#version-61)
    - [Version 6.0](#version-60)
    - [Version 5.x and 4.2.x](#version-5x-and-42x)
- [Next Feature](#next-feature)
- [License](#license)

---

Version Compatibility
---------------------

[](#version-compatibility)

LaravelImageuploadInstallation Command4.2.x[4.x](https://github.com/matriphe/laravel-imageupload/blob/laravel42/README.md) (obsolete)`composer require "matriphe/imageupload:4.2.*"`5.0.x / 5.1.x / 5.2.x / 5.3.x / 5.4.x[5.x](https://github.com/matriphe/laravel-imageupload/blob/laravel5/README.md) (stable)`composer require "matriphe/imageupload:5.*"`5.0.x / 5.1.x / 5.2.x / 5.3.x / 5.4.x6.0`composer require "matriphe/imageupload:6.0"`5.2.x / 5.3.x / 5.4.x / 5.5.x6.1.x (latest)`composer require "matriphe/imageupload:6.1.*"`The old version was following Laravel version. Now this package will use [semantic version (semver)](http://semver.org/) start from version 6.0.

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

[](#installation)

Open `composer.json` and require this line below.

```
"matriphe/imageupload": "6.*"
```

Or you can simply run this command from your project directory.

```
composer require "matriphe/imageupload"
```

### Laravel 5.0, 5.1, 5.2, 5.3, and 5.4

[](#laravel-50-51-52-53-and-54)

Open the `config/app.php` and add this line in `providers` section.

```
Matriphe\Imageupload\ImageuploadServiceProvider::class,
```

Still on `config/app.php` file, add this line in `aliases` section.

```
'Imageupload' => Matriphe\Imageupload\ImageuploadFacade::class,
```

### Laravel 5.5

[](#laravel-55)

Nothing to do. It used Laravel auto package discovery feature.

Publish Configuration and Migration File
----------------------------------------

[](#publish-configuration-and-migration-file)

To control the configuration, you have to publish the configuration file.

```
php artisan vendor:publish --provider="Matriphe\Imageupload\ImageuploadServiceProvider"
```

After running this command, there will be `config/imageupload.php` config file and `database/migrations/2017_07_24_024410_create_image_upload_table.php` migration file.

### Configuration

[](#configuration)

Please check the `config/imageupload.php` for more detail. You can use `.env` to config based on your environment.

If you want to publish the configuration file only, run this command.

```
php artisan vendor:publish --provider="Matriphe\Imageupload\ImageuploadServiceProvider" --tag=imageupload-config
```

### Migration

[](#migration)

By default, a migration file will create `image_uploads` table. Check the file and modify to fit your need.

If you want to publish the migration file only, run this command.

```
php artisan vendor:publish --provider="Matriphe\Imageupload\ImageuploadServiceProvider --tag=imageupload-migrations"
```

### Model

[](#model)

You can create a model to extend the built-in model, by extending `Matriphe\Imageupload\ImageuploadModel`. Please check this file too and adjust to fit your need.

```
