Download the PHP package todstoychev/icr without Composer
On this page you can find all versions of the php package todstoychev/icr. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download todstoychev/icr
More information about todstoychev/icr
Files in todstoychev/icr
Package icr
Short Description Image manipulation and upload module
License MIT
Homepage https://github.com/todstoychev/icr
Informations about the package icr
This is an image manipulation module based on the Imagine module. It is for Laravel 5.* php framework.
Installation
Use the standard composer way:
Or add to your composer.json:
and run
Configuration
In the section of your Laravel add: .
In the you can add:
Run to publish the config or you cal use also .
You will need also to set a new setting for the Storage module of Laravel. This can be done in the . You can create something similar:
Put this one at the section of the file.
The config file
The file can be found in it is called . The file contains several sections and parameters.
image_adapter
This is setting for the driver library that will be used to process the images. Imagine has support for Gd, Imagick and Gmagick, the available values are gd, imagick or gmagick.
Contexts
Those are the context settings. Each context is presented by array. The default one looks like this:
Each context can define different sizes. The size array has 3 parameters: width, height and operation.
Allowed operations are crop, resize, scale, resize-crop.
- crop - crops region from the center of the provided image;
- resize - resize image to given dimensions as keeps the proportions of the image;
- scale - scales the image to given dimensions;
- resize-crop - first resize the image while keeping the original proportions and then crops an region from the image center with the given size.
Methods
To use the module call its basic class - Icr. The class contain 2 methods. One to upload images, the other to delete. Another way to using it is to instantiate
Upload image
The Icr::uploadImage() method returns the file name on success. if any errors it returns an exception class instance. You can use something similar in your controller method:
As first argument you should use what is coming as file from the request, second argument is the context. The third argument is your setting name from the .
Delete image
This can be performed with Icr::deleteImage(). Example:
Parameters are the same as in the uploadImage() method, except the first one which is the file name of the file that should be deleted.
All versions of icr with dependencies
imagine/imagine Version 0.6.*
illuminate/support Version >5.1
illuminate/filesystem Version >5.1
league/flysystem Version ^1.0
symfony/http-foundation Version 2.7.*