Download the PHP package matriphe/imageupload without Composer
On this page you can find all versions of the php package matriphe/imageupload. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Informations about the package imageupload
Laravel Imageupload
Upload image easily using Laravel's build in function and resize it automatically.
- Version Compatibility
- Installation
- Laravel 5.0, 5.1, 5.2, 5.3, and 5.4
- Laravel 5.5
- Publish Configuration and Migration File
- Configuration
- Migration
- Model
- Try Upload Something!
- Route Example
- View
- Usage
- Set Output
- Example
- Output Example
- JSON
- Array
- Collection
- ImageuploadModel
- Changelog
- Version 6.1
- Version 6.0
- Version 5.x and 4.2.x
- Next Feature
- License
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.
Installation
Open composer.json
and require this line below.
Or you can simply run this command from your project directory.
Laravel 5.0, 5.1, 5.2, 5.3, and 5.4
Open the config/app.php
and add this line in providers
section.
Still on config/app.php
file, add this line in aliases
section.
Laravel 5.5
Nothing to do. It used Laravel auto package discovery feature.
Publish Configuration and Migration File
To control the configuration, you have to publish the configuration file.
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
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.
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.
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.
Try Upload Something!
After publishing the configuration file, you can set up a route, view, and start upload something.
The uploaded file will be saved in public/uploads
directory. Of course, you can change this by publishing and modifying configuration file.
Make sure the directory to store uploaded files is writable and can be accessed by public.
Route Example
View
Add this in your views directory.
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)
.
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.
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.
The db
option will automatically save output to database and return Matriphe\Imageupload\ImageuploadModel
object.
Example
Output Example
JSON
Array
Collection
ImageuploadModel
Changelog
Version 6.1
- Support output type
json
,array
,collection
, anddb
- Add support to change output type using
output()
method - Remove support for Laravel 5.0 and 5.1
Version 6.0
- Start using semantic version (semver) for versioning
- Using Intervention for image processing
- Support only GD and Imagick (ImageMagick), Gmagick is not supported anymore
- Using exception for better error handling
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.