2017 © Pedro Peláez
 

library imageupload

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

image

matriphe/imageupload

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

  • Monday, October 16, 2017
  • by matriphe
  • Repository
  • 8 Watchers
  • 65 Stars
  • 10,449 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 28 Forks
  • 2 Open issues
  • 19 Versions
  • 5 % Grown

The README.md

Laravel Imageupload

Build Status Total Download Latest Stable Version, (*1)

Upload image easily using Laravel's build in function and resize it automatically., (*2)



Version Compatibility

Laravel Imageupload Installation Command
4.2.x 4.x (obsolete) composer require "matriphe/imageupload:4.2.*"
5.0.x / 5.1.x / 5.2.x / 5.3.x / 5.4.x 5.x (stable) composer require "matriphe/imageupload:5.*"
5.0.x / 5.1.x / 5.2.x / 5.3.x / 5.4.x 6.0 composer require "matriphe/imageupload:6.0"
5.2.x / 5.3.x / 5.4.x / 5.5.x 6.1.x (latest) composer require "matriphe/imageupload:6.1.*"

The old version was following Laravel version. Now this package will use semantic version (semver) start from version 6.0., (*3)

Installation

Open composer.json and require this line below., (*4)

"matriphe/imageupload": "6.*"

Or you can simply run this command from your project directory., (*5)

composer require "matriphe/imageupload"

Laravel 5.0, 5.1, 5.2, 5.3, and 5.4

Open the config/app.php and add this line in providers section., (*6)

Matriphe\Imageupload\ImageuploadServiceProvider::class,

Still on config/app.php file, add this line in aliases section., (*7)

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

Laravel 5.5

Nothing to do. It used Laravel auto package discovery feature., (*8)

Publish Configuration and Migration File

To control the configuration, you have to publish the configuration file., (*9)

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., (*10)

Configuration

Please check the config/imageupload.php for more detail. You can use .env to config based on your environment., (*11)

If you want to publish the configuration file only, run this command., (*12)

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

Migration

By default, a migration file will create image_uploads table. Check the file and modify to fit your need., (*13)

If you want to publish the migration file only, run this command., (*14)

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

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., (*15)

<?php

namespace App;

use Matriphe\Imageupload\ImageuploadModel;

class Image extends ImageuploadModel
{
    protected $table = 'images';
}

Try Upload Something!

After publishing the configuration file, you can set up a route, view, and start upload something., (*16)

The uploaded file will be saved in public/uploads directory. Of course, you can change this by publishing and modifying configuration file., (*17)

Make sure the directory to store uploaded files is writable and can be accessed by public., (*18)

Route Example

<?php
// routes.php
Route::any('matriphe/imageupload', function() 
{
    $data = [];

    if (Request::hasFile('file')) {
        $data['result'] = Imageupload::upload(Request::file('file'));
    }

    return view('form.blade.php')->with($data);
});

View

Add this in your views directory., (*19)

<!DOCTYPE html>
<html>
    <head>
        <title>Imageupload</title>
    </head>
    <body>
        <form action="{{ URL::current() }}" method="post" enctype="multipart/form-data">
            <input type="hidden" name="_token" value="{{ Session::token() }}">
            <pre>{{ (!empty($result) ? print_r($result, 1) : '') }}</pre>
            <div>
                <input type="file" name="file">
            </div>
            <div>
                <button type="submit">Upload!</button>
            </div>
        </form>
    </body>
</html>

Usage

Just use the Imageupload::upload(Request::file('file')) function and it will take care of cropping and renaming. Of course, you can modify on the fly by passing parameter Imageupload::upload($filesource, $newfilename, $path)., (*20)

The return of the function is instance of Illuminate\Support\Collection. You can easily convert to array or JSON by using toArray() or toJson() method., (*21)

Set Output

To change the output on fly, use method ouput($output) before calling upload($request). The options is collection, json, db, and array (default). See the config file to set the default output., (*22)

The db option will automatically save output to database and return Matriphe\Imageupload\ImageuploadModel object., (*23)

Example

if (Request::hasFile('file')) {
    $result = Imageupload::upload(Request::file('file'));
}

if (Request::hasFile('file')) {
    $result = Imageupload::output('json')->upload(Request::file('file'));
}

Output Example

JSON

{  
    "original_filename":"IMG_20170619_195131.jpg",
    "original_filepath":"\/Volumes\/data\/Development\/php\/laravel\/51\/public\/uploads\/images\/IMG_20170619_195131.jpg",
    "original_filedir":"uploads\/images\/IMG_20170619_195131.jpg",
    "original_extension":"jpg",
    "original_mime":"image\/jpeg",
    "original_filesize":1379716,
    "original_width":2592,
    "original_height":4608,
    "exif":{  
        "FileName":"phpPfn2JP",
        "FileDateTime":1500894790,
        "FileSize":1379716,
        "FileType":2,
        "MimeType":"image\/jpeg",
        "SectionsFound":"ANY_TAG, IFD0, THUMBNAIL, EXIF, GPS, INTEROP",
        "COMPUTED":{  
            "html":"width=\"2592\" height=\"4608\"",
            "Height":4608,
            "Width":2592,
            "IsColor":1,
            "ByteOrderMotorola":1,
            "ApertureFNumber":"f\/2.0",
            "Thumbnail.FileType":2,
            "Thumbnail.MimeType":"image\/jpeg"
        },
        "Make":"Xiaomi",
        "Model":"Redmi Note3",
        "XResolution":"72\/1",
        "YResolution":"72\/1",
        "ResolutionUnit":2,
        "Software":"kenzo-user 6.0.1 MMB29M 7.6.7 release-keys",
        "DateTime":"2017:06:19 19:51:31",
        "YCbCrPositioning":1,
        "Exif_IFD_Pointer":234,
        "GPS_IFD_Pointer":718,
        "THUMBNAIL":{  
            "Compression":6,
            "XResolution":"72\/1",
            "YResolution":"72\/1",
            "ResolutionUnit":2,
            "JPEGInterchangeFormat":898,
            "JPEGInterchangeFormatLength":15696
        },
        "ExposureTime":"1\/33",
        "FNumber":"200\/100",
        "ExposureProgram":0,
        "ISOSpeedRatings":854,
        "ExifVersion":"0220",
        "DateTimeOriginal":"2017:06:19 19:51:31",
        "DateTimeDigitized":"2017:06:19 19:51:31",
        "ComponentsConfiguration":"\u0001\u0002\u0003\u0000",
        "ShutterSpeedValue":"5058\/1000",
        "ApertureValue":"200\/100",
        "BrightnessValue":"300\/100",
        "MeteringMode":1,
        "Flash":16,
        "FocalLength":"357\/100",
        "SubSecTime":"123298",
        "SubSecTimeOriginal":"123298",
        "SubSecTimeDigitized":"123298",
        "FlashPixVersion":"0100",
        "ColorSpace":1,
        "ExifImageWidth":2592,
        "ExifImageLength":4608,
        "InteroperabilityOffset":687,
        "SensingMethod":2,
        "SceneType":"\u0001",
        "ExposureMode":0,
        "WhiteBalance":0,
        "FocalLengthIn35mmFilm":4,
        "SceneCaptureType":0,
        "GPSAltitudeRef":"200\/100",
        "GPSTimeStamp":[  
            "12\/1",
            "51\/1",
            "30\/1"
        ],
        "GPSDateStamp":"2017:06:19",
        "InterOperabilityIndex":"R98",
        "InterOperabilityVersion":"0100"
    },
    "path":"\/Volumes\/data\/Development\/php\/laravel\/51\/public\/uploads\/images",
    "dir":"uploads\/images",
    "filename":"IMG_20170619_195131.jpg",
    "basename":"IMG_20170619_195131",
    "dimensions":{  
        "square50":{  
            "path":"\/Volumes\/data\/Development\/php\/laravel\/51\/public\/uploads\/images",
            "dir":"uploads\/images\/IMG_20170619_195131_square50.jpg",
            "filename":"IMG_20170619_195131_square50.jpg",
            "filepath":"\/Volumes\/data\/Development\/php\/laravel\/51\/public\/uploads\/images\/IMG_20170619_195131_square50.jpg",
            "filedir":"uploads\/images\/IMG_20170619_195131_square50.jpg",
            "width":50,
            "height":50,
            "filesize":1379716,
            "is_squared":true
        },
        "square100":{  
            "path":"\/Volumes\/data\/Development\/php\/laravel\/51\/public\/uploads\/images",
            "dir":"uploads\/images\/IMG_20170619_195131_square100.jpg",
            "filename":"IMG_20170619_195131_square100.jpg",
            "filepath":"\/Volumes\/data\/Development\/php\/laravel\/51\/public\/uploads\/images\/IMG_20170619_195131_square100.jpg",
            "filedir":"uploads\/images\/IMG_20170619_195131_square100.jpg",
            "width":100,
            "height":100,
            "filesize":1379716,
            "is_squared":true
        },
        "square200":{  
            "path":"\/Volumes\/data\/Development\/php\/laravel\/51\/public\/uploads\/images",
            "dir":"uploads\/images\/IMG_20170619_195131_square200.jpg",
            "filename":"IMG_20170619_195131_square200.jpg",
            "filepath":"\/Volumes\/data\/Development\/php\/laravel\/51\/public\/uploads\/images\/IMG_20170619_195131_square200.jpg",
            "filedir":"uploads\/images\/IMG_20170619_195131_square200.jpg",
            "width":200,
            "height":200,
            "filesize":1379716,
            "is_squared":true
        },
        "square400":{  
            "path":"\/Volumes\/data\/Development\/php\/laravel\/51\/public\/uploads\/images",
            "dir":"uploads\/images\/IMG_20170619_195131_square400.jpg",
            "filename":"IMG_20170619_195131_square400.jpg",
            "filepath":"\/Volumes\/data\/Development\/php\/laravel\/51\/public\/uploads\/images\/IMG_20170619_195131_square400.jpg",
            "filedir":"uploads\/images\/IMG_20170619_195131_square400.jpg",
            "width":400,
            "height":400,
            "filesize":1379716,
            "is_squared":true
        },
        "size50":{  
            "path":"\/Volumes\/data\/Development\/php\/laravel\/51\/public\/uploads\/images",
            "dir":"uploads\/images\/IMG_20170619_195131_size50.jpg",
            "filename":"IMG_20170619_195131_size50.jpg",
            "filepath":"\/Volumes\/data\/Development\/php\/laravel\/51\/public\/uploads\/images\/IMG_20170619_195131_size50.jpg",
            "filedir":"uploads\/images\/IMG_20170619_195131_size50.jpg",
            "width":28,
            "height":50,
            "filesize":1379716,
            "is_squared":false
        },
        "size100":{  
            "path":"\/Volumes\/data\/Development\/php\/laravel\/51\/public\/uploads\/images",
            "dir":"uploads\/images\/IMG_20170619_195131_size100.jpg",
            "filename":"IMG_20170619_195131_size100.jpg",
            "filepath":"\/Volumes\/data\/Development\/php\/laravel\/51\/public\/uploads\/images\/IMG_20170619_195131_size100.jpg",
            "filedir":"uploads\/images\/IMG_20170619_195131_size100.jpg",
            "width":56,
            "height":100,
            "filesize":1379716,
            "is_squared":false
        },
        "size200":{  
            "path":"\/Volumes\/data\/Development\/php\/laravel\/51\/public\/uploads\/images",
            "dir":"uploads\/images\/IMG_20170619_195131_size200.jpg",
            "filename":"IMG_20170619_195131_size200.jpg",
            "filepath":"\/Volumes\/data\/Development\/php\/laravel\/51\/public\/uploads\/images\/IMG_20170619_195131_size200.jpg",
            "filedir":"uploads\/images\/IMG_20170619_195131_size200.jpg",
            "width":112,
            "height":200,
            "filesize":1379716,
            "is_squared":false
        },
        "size400":{  
            "path":"\/Volumes\/data\/Development\/php\/laravel\/51\/public\/uploads\/images",
            "dir":"uploads\/images\/IMG_20170619_195131_size400.jpg",
            "filename":"IMG_20170619_195131_size400.jpg",
            "filepath":"\/Volumes\/data\/Development\/php\/laravel\/51\/public\/uploads\/images\/IMG_20170619_195131_size400.jpg",
            "filedir":"uploads\/images\/IMG_20170619_195131_size400.jpg",
            "width":225,
            "height":400,
            "filesize":1379716,
            "is_squared":false
        }
    }
}

Array

Array
(
    [original_filename] => IMG_20170619_195131.jpg
    [original_filepath] => /Volumes/data/Development/php/laravel/51/public/uploads/images/IMG_20170619_195131.jpg
    [original_filedir] => uploads/images/IMG_20170619_195131.jpg
    [original_extension] => jpg
    [original_mime] => image/jpeg
    [original_filesize] => 1379716
    [original_width] => 2592
    [original_height] => 4608
    [exif] => Array
        (
            [FileName] => phpPfn2JP
            [FileDateTime] => 1500894790
            [FileSize] => 1379716
            [FileType] => 2
            [MimeType] => image/jpeg
            [SectionsFound] => ANY_TAG, IFD0, THUMBNAIL, EXIF, GPS, INTEROP
            [COMPUTED] => Array
                (
                    [html] => width="2592" height="4608"
                    [Height] => 4608
                    [Width] => 2592
                    [IsColor] => 1
                    [ByteOrderMotorola] => 1
                    [ApertureFNumber] => f/2.0
                    [Thumbnail.FileType] => 2
                    [Thumbnail.MimeType] => image/jpeg
                )

            [Make] => Xiaomi
            [Model] => Redmi Note3
            [XResolution] => 72/1
            [YResolution] => 72/1
            [ResolutionUnit] => 2
            [Software] => kenzo-user 6.0.1 MMB29M 7.6.7 release-keys
            [DateTime] => 2017:06:19 19:51:31
            [YCbCrPositioning] => 1
            [Exif_IFD_Pointer] => 234
            [GPS_IFD_Pointer] => 718
            [THUMBNAIL] => Array
                (
                    [Compression] => 6
                    [XResolution] => 72/1
                    [YResolution] => 72/1
                    [ResolutionUnit] => 2
                    [JPEGInterchangeFormat] => 898
                    [JPEGInterchangeFormatLength] => 15696
                )

            [ExposureTime] => 1/33
            [FNumber] => 200/100
            [ExposureProgram] => 0
            [ISOSpeedRatings] => 854
            [ExifVersion] => 0220
            [DateTimeOriginal] => 2017:06:19 19:51:31
            [DateTimeDigitized] => 2017:06:19 19:51:31
            [ComponentsConfiguration] => 
            [ShutterSpeedValue] => 5058/1000
            [ApertureValue] => 200/100
            [BrightnessValue] => 300/100
            [MeteringMode] => 1
            [Flash] => 16
            [FocalLength] => 357/100
            [SubSecTime] => 123298
            [SubSecTimeOriginal] => 123298
            [SubSecTimeDigitized] => 123298
            [FlashPixVersion] => 0100
            [ColorSpace] => 1
            [ExifImageWidth] => 2592
            [ExifImageLength] => 4608
            [InteroperabilityOffset] => 687
            [SensingMethod] => 2
            [SceneType] => 
            [ExposureMode] => 0
            [WhiteBalance] => 0
            [FocalLengthIn35mmFilm] => 4
            [SceneCaptureType] => 0
            [GPSAltitudeRef] => 200/100
            [GPSTimeStamp] => Array
                (
                    [0] => 12/1
                    [1] => 51/1
                    [2] => 30/1
                )

            [GPSDateStamp] => 2017:06:19
            [InterOperabilityIndex] => R98
            [InterOperabilityVersion] => 0100
        )

    [path] => /Volumes/data/Development/php/laravel/51/public/uploads/images
    [dir] => uploads/images
    [filename] => IMG_20170619_195131.jpg
    [basename] => IMG_20170619_195131
    [dimensions] => Array
        (
            [square50] => Array
                (
                    [path] => /Volumes/data/Development/php/laravel/51/public/uploads/images
                    [dir] => uploads/images/IMG_20170619_195131_square50.jpg
                    [filename] => IMG_20170619_195131_square50.jpg
                    [filepath] => /Volumes/data/Development/php/laravel/51/public/uploads/images/IMG_20170619_195131_square50.jpg
                    [filedir] => uploads/images/IMG_20170619_195131_square50.jpg
                    [width] => 50
                    [height] => 50
                    [filesize] => 1379716
                    [is_squared] => 1
                )

            [square100] => Array
                (
                    [path] => /Volumes/data/Development/php/laravel/51/public/uploads/images
                    [dir] => uploads/images/IMG_20170619_195131_square100.jpg
                    [filename] => IMG_20170619_195131_square100.jpg
                    [filepath] => /Volumes/data/Development/php/laravel/51/public/uploads/images/IMG_20170619_195131_square100.jpg
                    [filedir] => uploads/images/IMG_20170619_195131_square100.jpg
                    [width] => 100
                    [height] => 100
                    [filesize] => 1379716
                    [is_squared] => 1
                )

            [square200] => Array
                (
                    [path] => /Volumes/data/Development/php/laravel/51/public/uploads/images
                    [dir] => uploads/images/IMG_20170619_195131_square200.jpg
                    [filename] => IMG_20170619_195131_square200.jpg
                    [filepath] => /Volumes/data/Development/php/laravel/51/public/uploads/images/IMG_20170619_195131_square200.jpg
                    [filedir] => uploads/images/IMG_20170619_195131_square200.jpg
                    [width] => 200
                    [height] => 200
                    [filesize] => 1379716
                    [is_squared] => 1
                )

            [square400] => Array
                (
                    [path] => /Volumes/data/Development/php/laravel/51/public/uploads/images
                    [dir] => uploads/images/IMG_20170619_195131_square400.jpg
                    [filename] => IMG_20170619_195131_square400.jpg
                    [filepath] => /Volumes/data/Development/php/laravel/51/public/uploads/images/IMG_20170619_195131_square400.jpg
                    [filedir] => uploads/images/IMG_20170619_195131_square400.jpg
                    [width] => 400
                    [height] => 400
                    [filesize] => 1379716
                    [is_squared] => 1
                )

            [size50] => Array
                (
                    [path] => /Volumes/data/Development/php/laravel/51/public/uploads/images
                    [dir] => uploads/images/IMG_20170619_195131_size50.jpg
                    [filename] => IMG_20170619_195131_size50.jpg
                    [filepath] => /Volumes/data/Development/php/laravel/51/public/uploads/images/IMG_20170619_195131_size50.jpg
                    [filedir] => uploads/images/IMG_20170619_195131_size50.jpg
                    [width] => 28
                    [height] => 50
                    [filesize] => 1379716
                    [is_squared] => 
                )

            [size100] => Array
                (
                    [path] => /Volumes/data/Development/php/laravel/51/public/uploads/images
                    [dir] => uploads/images/IMG_20170619_195131_size100.jpg
                    [filename] => IMG_20170619_195131_size100.jpg
                    [filepath] => /Volumes/data/Development/php/laravel/51/public/uploads/images/IMG_20170619_195131_size100.jpg
                    [filedir] => uploads/images/IMG_20170619_195131_size100.jpg
                    [width] => 56
                    [height] => 100
                    [filesize] => 1379716
                    [is_squared] => 
                )

            [size200] => Array
                (
                    [path] => /Volumes/data/Development/php/laravel/51/public/uploads/images
                    [dir] => uploads/images/IMG_20170619_195131_size200.jpg
                    [filename] => IMG_20170619_195131_size200.jpg
                    [filepath] => /Volumes/data/Development/php/laravel/51/public/uploads/images/IMG_20170619_195131_size200.jpg
                    [filedir] => uploads/images/IMG_20170619_195131_size200.jpg
                    [width] => 112
                    [height] => 200
                    [filesize] => 1379716
                    [is_squared] => 
                )

            [size400] => Array
                (
                    [path] => /Volumes/data/Development/php/laravel/51/public/uploads/images
                    [dir] => uploads/images/IMG_20170619_195131_size400.jpg
                    [filename] => IMG_20170619_195131_size400.jpg
                    [filepath] => /Volumes/data/Development/php/laravel/51/public/uploads/images/IMG_20170619_195131_size400.jpg
                    [filedir] => uploads/images/IMG_20170619_195131_size400.jpg
                    [width] => 225
                    [height] => 400
                    [filesize] => 1379716
                    [is_squared] => 
                )

        )

)

Collection

Illuminate\Support\Collection Object
(
    [items:protected] => Array
        (
            [original_filename] => IMG_20170619_195131.jpg
            [original_filepath] => /Volumes/data/Development/php/laravel/51/public/uploads/images/IMG_20170619_195131.jpg
            [original_filedir] => uploads/images/IMG_20170619_195131.jpg
            [original_extension] => jpg
            [original_mime] => image/jpeg
            [original_filesize] => 1379716
            [original_width] => 2592
            [original_height] => 4608
            [exif] => Array
                (
                    [FileName] => phpGacSlt
                    [FileDateTime] => 1500895792
                    [FileSize] => 1379716
                    [FileType] => 2
                    [MimeType] => image/jpeg
                    [SectionsFound] => ANY_TAG, IFD0, THUMBNAIL, EXIF, GPS, INTEROP
                    [COMPUTED] => Array
                        (
                            [html] => width="2592" height="4608"
                            [Height] => 4608
                            [Width] => 2592
                            [IsColor] => 1
                            [ByteOrderMotorola] => 1
                            [ApertureFNumber] => f/2.0
                            [Thumbnail.FileType] => 2
                            [Thumbnail.MimeType] => image/jpeg
                        )

                    [Make] => Xiaomi
                    [Model] => Redmi Note3
                    [XResolution] => 72/1
                    [YResolution] => 72/1
                    [ResolutionUnit] => 2
                    [Software] => kenzo-user 6.0.1 MMB29M 7.6.7 release-keys
                    [DateTime] => 2017:06:19 19:51:31
                    [YCbCrPositioning] => 1
                    [Exif_IFD_Pointer] => 234
                    [GPS_IFD_Pointer] => 718
                    [THUMBNAIL] => Array
                        (
                            [Compression] => 6
                            [XResolution] => 72/1
                            [YResolution] => 72/1
                            [ResolutionUnit] => 2
                            [JPEGInterchangeFormat] => 898
                            [JPEGInterchangeFormatLength] => 15696
                        )

                    [ExposureTime] => 1/33
                    [FNumber] => 200/100
                    [ExposureProgram] => 0
                    [ISOSpeedRatings] => 854
                    [ExifVersion] => 0220
                    [DateTimeOriginal] => 2017:06:19 19:51:31
                    [DateTimeDigitized] => 2017:06:19 19:51:31
                    [ComponentsConfiguration] => 
                    [ShutterSpeedValue] => 5058/1000
                    [ApertureValue] => 200/100
                    [BrightnessValue] => 300/100
                    [MeteringMode] => 1
                    [Flash] => 16
                    [FocalLength] => 357/100
                    [SubSecTime] => 123298
                    [SubSecTimeOriginal] => 123298
                    [SubSecTimeDigitized] => 123298
                    [FlashPixVersion] => 0100
                    [ColorSpace] => 1
                    [ExifImageWidth] => 2592
                    [ExifImageLength] => 4608
                    [InteroperabilityOffset] => 687
                    [SensingMethod] => 2
                    [SceneType] => 
                    [ExposureMode] => 0
                    [WhiteBalance] => 0
                    [FocalLengthIn35mmFilm] => 4
                    [SceneCaptureType] => 0
                    [GPSAltitudeRef] => 200/100
                    [GPSTimeStamp] => Array
                        (
                            [0] => 12/1
                            [1] => 51/1
                            [2] => 30/1
                        )

                    [GPSDateStamp] => 2017:06:19
                    [InterOperabilityIndex] => R98
                    [InterOperabilityVersion] => 0100
                )

            [path] => /Volumes/data/Development/php/laravel/51/public/uploads/images
            [dir] => uploads/images
            [filename] => IMG_20170619_195131.jpg
            [basename] => IMG_20170619_195131
            [dimensions] => Array
                (
                    [square50] => Array
                        (
                            [path] => /Volumes/data/Development/php/laravel/51/public/uploads/images
                            [dir] => uploads/images/IMG_20170619_195131_square50.jpg
                            [filename] => IMG_20170619_195131_square50.jpg
                            [filepath] => /Volumes/data/Development/php/laravel/51/public/uploads/images/IMG_20170619_195131_square50.jpg
                            [filedir] => uploads/images/IMG_20170619_195131_square50.jpg
                            [width] => 50
                            [height] => 50
                            [filesize] => 1379716
                            [is_squared] => 1
                        )

                    [square100] => Array
                        (
                            [path] => /Volumes/data/Development/php/laravel/51/public/uploads/images
                            [dir] => uploads/images/IMG_20170619_195131_square100.jpg
                            [filename] => IMG_20170619_195131_square100.jpg
                            [filepath] => /Volumes/data/Development/php/laravel/51/public/uploads/images/IMG_20170619_195131_square100.jpg
                            [filedir] => uploads/images/IMG_20170619_195131_square100.jpg
                            [width] => 100
                            [height] => 100
                            [filesize] => 1379716
                            [is_squared] => 1
                        )

                    [square200] => Array
                        (
                            [path] => /Volumes/data/Development/php/laravel/51/public/uploads/images
                            [dir] => uploads/images/IMG_20170619_195131_square200.jpg
                            [filename] => IMG_20170619_195131_square200.jpg
                            [filepath] => /Volumes/data/Development/php/laravel/51/public/uploads/images/IMG_20170619_195131_square200.jpg
                            [filedir] => uploads/images/IMG_20170619_195131_square200.jpg
                            [width] => 200
                            [height] => 200
                            [filesize] => 1379716
                            [is_squared] => 1
                        )

                    [square400] => Array
                        (
                            [path] => /Volumes/data/Development/php/laravel/51/public/uploads/images
                            [dir] => uploads/images/IMG_20170619_195131_square400.jpg
                            [filename] => IMG_20170619_195131_square400.jpg
                            [filepath] => /Volumes/data/Development/php/laravel/51/public/uploads/images/IMG_20170619_195131_square400.jpg
                            [filedir] => uploads/images/IMG_20170619_195131_square400.jpg
                            [width] => 400
                            [height] => 400
                            [filesize] => 1379716
                            [is_squared] => 1
                        )

                    [size50] => Array
                        (
                            [path] => /Volumes/data/Development/php/laravel/51/public/uploads/images
                            [dir] => uploads/images/IMG_20170619_195131_size50.jpg
                            [filename] => IMG_20170619_195131_size50.jpg
                            [filepath] => /Volumes/data/Development/php/laravel/51/public/uploads/images/IMG_20170619_195131_size50.jpg
                            [filedir] => uploads/images/IMG_20170619_195131_size50.jpg
                            [width] => 28
                            [height] => 50
                            [filesize] => 1379716
                            [is_squared] => 
                        )

                    [size100] => Array
                        (
                            [path] => /Volumes/data/Development/php/laravel/51/public/uploads/images
                            [dir] => uploads/images/IMG_20170619_195131_size100.jpg
                            [filename] => IMG_20170619_195131_size100.jpg
                            [filepath] => /Volumes/data/Development/php/laravel/51/public/uploads/images/IMG_20170619_195131_size100.jpg
                            [filedir] => uploads/images/IMG_20170619_195131_size100.jpg
                            [width] => 56
                            [height] => 100
                            [filesize] => 1379716
                            [is_squared] => 
                        )

                    [size200] => Array
                        (
                            [path] => /Volumes/data/Development/php/laravel/51/public/uploads/images
                            [dir] => uploads/images/IMG_20170619_195131_size200.jpg
                            [filename] => IMG_20170619_195131_size200.jpg
                            [filepath] => /Volumes/data/Development/php/laravel/51/public/uploads/images/IMG_20170619_195131_size200.jpg
                            [filedir] => uploads/images/IMG_20170619_195131_size200.jpg
                            [width] => 112
                            [height] => 200
                            [filesize] => 1379716
                            [is_squared] => 
                        )

                    [size400] => Array
                        (
                            [path] => /Volumes/data/Development/php/laravel/51/public/uploads/images
                            [dir] => uploads/images/IMG_20170619_195131_size400.jpg
                            [filename] => IMG_20170619_195131_size400.jpg
                            [filepath] => /Volumes/data/Development/php/laravel/51/public/uploads/images/IMG_20170619_195131_size400.jpg
                            [filedir] => uploads/images/IMG_20170619_195131_size400.jpg
                            [width] => 225
                            [height] => 400
                            [filesize] => 1379716
                            [is_squared] => 
                        )

                )

        )

)

ImageuploadModel

Matriphe\Imageupload\ImageuploadModel Object
(
    [thumbnailKeys:protected] => Array
        (
            [0] => path
            [1] => dir
            [2] => filename
            [3] => filepath
            [4] => filedir
            [5] => width
            [6] => height
            [7] => filesize
        )

    [fillable:protected] => Array
        (
            [0] => original_filename
            [1] => original_filepath
            [2] => original_filedir
            [3] => original_extension
            [4] => original_mime
            [5] => original_filesize
            [6] => original_width
            [7] => original_height
            [8] => path
            [9] => dir
            [10] => filename
            [11] => basename
            [12] => exif
        )

    [connection:protected] => 
    [table:protected] => image_uploads
    [primaryKey:protected] => id
    [perPage:protected] => 15
    [incrementing] => 1
    [timestamps] => 1
    [attributes:protected] => Array
        (
            [original_filename] => IMG_20170619_195131.jpg
            [original_filepath] => /Volumes/data/Development/php/laravel/51/public/uploads/images/IMG_20170619_195131.jpg
            [original_filedir] => uploads/images/IMG_20170619_195131.jpg
            [original_extension] => jpg
            [original_mime] => image/jpeg
            [original_filesize] => 1379716
            [original_width] => 2592
            [original_height] => 4608
            [exif] => {"FileName":"php19qj3X","FileDateTime":1500906046,"FileSize":1379716,"FileType":2,"MimeType":"image\/jpeg","SectionsFound":"ANY_TAG, IFD0, THUMBNAIL, EXIF, GPS, INTEROP","COMPUTED":{"html":"width=\"2592\" height=\"4608\"","Height":4608,"Width":2592,"IsColor":1,"ByteOrderMotorola":1,"ApertureFNumber":"f\/2.0","Thumbnail.FileType":2,"Thumbnail.MimeType":"image\/jpeg"},"Make":"Xiaomi","Model":"Redmi Note3","XResolution":"72\/1","YResolution":"72\/1","ResolutionUnit":2,"Software":"kenzo-user 6.0.1 MMB29M 7.6.7 release-keys","DateTime":"2017:06:19 19:51:31","YCbCrPositioning":1,"Exif_IFD_Pointer":234,"GPS_IFD_Pointer":718,"THUMBNAIL":{"Compression":6,"XResolution":"72\/1","YResolution":"72\/1","ResolutionUnit":2,"JPEGInterchangeFormat":898,"JPEGInterchangeFormatLength":15696},"ExposureTime":"1\/33","FNumber":"200\/100","ExposureProgram":0,"ISOSpeedRatings":854,"ExifVersion":"0220","DateTimeOriginal":"2017:06:19 19:51:31","DateTimeDigitized":"2017:06:19 19:51:31","ComponentsConfiguration":"\u0001\u0002\u0003\u0000","ShutterSpeedValue":"5058\/1000","ApertureValue":"200\/100","BrightnessValue":"300\/100","MeteringMode":1,"Flash":16,"FocalLength":"357\/100","SubSecTime":"123298","SubSecTimeOriginal":"123298","SubSecTimeDigitized":"123298","FlashPixVersion":"0100","ColorSpace":1,"ExifImageWidth":2592,"ExifImageLength":4608,"InteroperabilityOffset":687,"SensingMethod":2,"SceneType":"\u0001","ExposureMode":0,"WhiteBalance":0,"FocalLengthIn35mmFilm":4,"SceneCaptureType":0,"GPSAltitudeRef":"200\/100","GPSTimeStamp":["12\/1","51\/1","30\/1"],"GPSDateStamp":"2017:06:19","InterOperabilityIndex":"R98","InterOperabilityVersion":"0100"}
            [path] => /Volumes/data/Development/php/laravel/51/public/uploads/images
            [dir] => uploads/images
            [filename] => IMG_20170619_195131.jpg
            [basename] => IMG_20170619_195131
            [updated_at] => 2017-07-24 21:20:53
            [created_at] => 2017-07-24 21:20:53
            [id] => 1
        )

    [original:protected] => Array
        (
            [original_filename] => IMG_20170619_195131.jpg
            [original_filepath] => /Volumes/data/Development/php/laravel/51/public/uploads/images/IMG_20170619_195131.jpg
            [original_filedir] => uploads/images/IMG_20170619_195131.jpg
            [original_extension] => jpg
            [original_mime] => image/jpeg
            [original_filesize] => 1379716
            [original_width] => 2592
            [original_height] => 4608
            [exif] => {"FileName":"php19qj3X","FileDateTime":1500906046,"FileSize":1379716,"FileType":2,"MimeType":"image\/jpeg","SectionsFound":"ANY_TAG, IFD0, THUMBNAIL, EXIF, GPS, INTEROP","COMPUTED":{"html":"width=\"2592\" height=\"4608\"","Height":4608,"Width":2592,"IsColor":1,"ByteOrderMotorola":1,"ApertureFNumber":"f\/2.0","Thumbnail.FileType":2,"Thumbnail.MimeType":"image\/jpeg"},"Make":"Xiaomi","Model":"Redmi Note3","XResolution":"72\/1","YResolution":"72\/1","ResolutionUnit":2,"Software":"kenzo-user 6.0.1 MMB29M 7.6.7 release-keys","DateTime":"2017:06:19 19:51:31","YCbCrPositioning":1,"Exif_IFD_Pointer":234,"GPS_IFD_Pointer":718,"THUMBNAIL":{"Compression":6,"XResolution":"72\/1","YResolution":"72\/1","ResolutionUnit":2,"JPEGInterchangeFormat":898,"JPEGInterchangeFormatLength":15696},"ExposureTime":"1\/33","FNumber":"200\/100","ExposureProgram":0,"ISOSpeedRatings":854,"ExifVersion":"0220","DateTimeOriginal":"2017:06:19 19:51:31","DateTimeDigitized":"2017:06:19 19:51:31","ComponentsConfiguration":"\u0001\u0002\u0003\u0000","ShutterSpeedValue":"5058\/1000","ApertureValue":"200\/100","BrightnessValue":"300\/100","MeteringMode":1,"Flash":16,"FocalLength":"357\/100","SubSecTime":"123298","SubSecTimeOriginal":"123298","SubSecTimeDigitized":"123298","FlashPixVersion":"0100","ColorSpace":1,"ExifImageWidth":2592,"ExifImageLength":4608,"InteroperabilityOffset":687,"SensingMethod":2,"SceneType":"\u0001","ExposureMode":0,"WhiteBalance":0,"FocalLengthIn35mmFilm":4,"SceneCaptureType":0,"GPSAltitudeRef":"200\/100","GPSTimeStamp":["12\/1","51\/1","30\/1"],"GPSDateStamp":"2017:06:19","InterOperabilityIndex":"R98","InterOperabilityVersion":"0100"}
            [path] => /Volumes/data/Development/php/laravel/51/public/uploads/images
            [dir] => uploads/images
            [filename] => IMG_20170619_195131.jpg
            [basename] => IMG_20170619_195131
            [updated_at] => 2017-07-24 21:20:53
            [created_at] => 2017-07-24 21:20:53
            [id] => 1
        )

    [relations:protected] => Array
        (
        )

    [hidden:protected] => Array
        (
        )

    [visible:protected] => Array
        (
        )

    [appends:protected] => Array
        (
        )

    [guarded:protected] => Array
        (
            [0] => *
        )

    [dates:protected] => Array
        (
        )

    [dateFormat:protected] => 
    [casts:protected] => Array
        (
        )

    [touches:protected] => Array
        (
        )

    [observables:protected] => Array
        (
        )

    [with:protected] => Array
        (
        )

    [morphClass:protected] => 
    [exists] => 1
    [wasRecentlyCreated] => 1
)

Changelog

Version 6.1

  • Support output type json, array, collection, and db
  • Add support to change output type using output() method
  • Remove support for Laravel 5.0 and 5.1

Version 6.0

Version 5.x and 4.2.x

  • Last version that follow Laravel versioning
  • Last version that use Imagine library

Next Feature

  • Utilize Laravel's filesystem to store uploaded file.
  • Add Lumen support

License

The MIT License (MIT). Please see License File for more information., (*24)

The Versions

16/10 2017

dev-master

9999999-dev

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

  Sources   Download

MIT

The Requires

 

The Development Requires

laravel upload image imagine intervention

16/10 2017

6.1.2

6.1.2.0

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

  Sources   Download

MIT

The Requires

 

The Development Requires

laravel upload image imagine intervention

07/08 2017

6.1.1

6.1.1.0

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

  Sources   Download

MIT

The Requires

 

The Development Requires

laravel upload image imagine intervention

24/07 2017

6.1.0

6.1.0.0

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

  Sources   Download

MIT

The Requires

 

The Development Requires

laravel upload image imagine intervention

23/07 2017

6.0

6.0.0.0

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

  Sources   Download

MIT

The Requires

 

The Development Requires

laravel upload image imagine intervention

23/07 2017

dev-laravel5

dev-laravel5

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

  Sources   Download

MIT

The Requires

 

The Development Requires

laravel upload image imagine

23/07 2017

dev-laravel42

dev-laravel42

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

  Sources   Download

MIT

The Requires

 

The Development Requires

laravel upload image imagine

26/03 2017

5.4

5.4.0.0

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

  Sources   Download

MIT

The Requires

 

The Development Requires

laravel upload image imagine

22/05 2016

dev-rewrite

dev-rewrite

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

  Sources   Download

MIT

The Requires

 

The Development Requires

laravel upload image imagine

21/05 2016

5.2

5.2.0.0

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

  Sources   Download

MIT

The Requires

 

The Development Requires

laravel upload image imagine

06/01 2016

dev-laravel51

dev-laravel51

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

  Sources   Download

MIT

The Requires

 

The Development Requires

laravel upload image imagine

06/01 2016

5.1.2

5.1.2.0

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

  Sources   Download

MIT

The Requires

 

The Development Requires

laravel upload image imagine

24/10 2015

5.1.1

5.1.1.0

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

  Sources   Download

MIT

The Requires

 

The Development Requires

laravel upload image imagine

24/10 2015

dev-laravel50

dev-laravel50

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

  Sources   Download

MIT

The Requires

 

The Development Requires

laravel upload image imagine

24/10 2015

5.0.1

5.0.1.0

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

  Sources   Download

MIT

The Requires

 

The Development Requires

laravel upload image imagine

24/10 2015

4.2.1

4.2.1.0

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

  Sources   Download

MIT

The Requires

 

The Development Requires

laravel upload image imagine

13/06 2015

5.0

5.0.0.0

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

  Sources   Download

MIT

The Requires

 

The Development Requires

laravel upload image imagine

13/06 2015

4.2

4.2.0.0

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

  Sources   Download

MIT

The Requires

 

The Development Requires

laravel upload image imagine

13/06 2015

5.1

5.1.0.0

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

  Sources   Download

MIT

The Requires

 

The Development Requires

laravel upload image imagine