Download the PHP package eleven59/backpack-image-traits without Composer
On this page you can find all versions of the php package eleven59/backpack-image-traits. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download eleven59/backpack-image-traits
More information about eleven59/backpack-image-traits
Files in eleven59/backpack-image-traits
Package backpack-image-traits
Short Description Backpack for Laravel helper traits for processing image upload fields (including within repeatable fields)
License MIT
Homepage https://github.com/eleven59/backpack-image-traits
Informations about the package backpack-image-traits
BackpackImageTraits
Backpack for Laravel helper traits for processing image upload fields (including in repeatable fields)
This package provides helper traits for processing Backpack's built-in image fields. With these traits, you'll only have to add a function with one line of code to process image fields.
Installation
Dependencies
This package requires
Installation
Via Composer
Usage
The two traits included in this package allow you to process Backpack for Laravel fields of the 'image' type with only a single line of code. More lines of code available if you need to tweak things (see options below).
Image fields
For single top-level image fields: 1) Add HasImageFields Trait to Model 2) Add setAttribute function for the image field
Images within repeatable fields
If you have a repeatable field in your model that has one or more child image fields: 1) Add HasImageFields and HasImagesInRepeatableFields Traits to Model 2) Add setAttribute function for the repeatable field
Options
Both traits support the same array of options to customize how the image upload is processed. For repeatable fields, the same options will be used for every image field in the repeatable field's child array.
All available options are displayed below with their default values.
Supported formats: all intervention image formats except data-url, so as of Intervention Image 2.5.1:
- jpg
- png
- gif
- tif
- bmp
- ico
- psd
- webp
Advanced examples using callables
The transformations callable can be used to perform additional transformations using the Intervention Image object (see Intervention Image docs).
The callback callable allows you to override the return function using the generated filename as an input variable.
Change log
Breaking changes will be listed here. For other changes see commit log.
Credits
License
This project was released under the MIT license, so you can install it on top of any Backpack & Laravel project. Please see the license file for more information.
However, please note that you do need Backpack installed, so you need to also abide by its YUMMY License. That means in production you'll need a Backpack license code. You can get a free one for non-commercial use (or a paid one for commercial use) on backpackforlaravel.com.
All versions of backpack-image-traits with dependencies
intervention/image Version ^2.5
backpack/crud Version ^4.1.0|^5.0