Skip to content

A simple cache library and image formatting in PHP [WIP]

Notifications You must be signed in to change notification settings

Devel8/laravel-image-filter

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Laravel Image Filter

A simple cache library and image formatting in PHP

Requirements

  • PHP >=5.4
  • Fileinfo Extension

Supported image libraries

  • GD Library (>=2.0)
  • Imagick PHP extension (>=6.5.7)

Installation

Execute the following command to get the latest version of the package:

composer require devel8/laravel-image-filter

In your config/app.php add Devel8\LaravelImageFilter\ImageFilterProvider::class to the end of the providers array:

'providers' => [
    ...
    Devel8\LaravelImageFilter\ImageFilterProvider::class,
],

If Lumen

$app->register(Devel8\LaravelImageFilter\ImageFilterProvider::class);

Publish Configuration

php artisan vendor:publish --provider "Devel8\LaravelImageFilter\ImageFilterProvider"

How to use

$imageFilteredUrl = $imageManager->resolve( '/source/image/path/file.jpg', 'image_small' );

Configuration parameters

Parameter Type Value Description
path.source String Path where the original image is stored
path.cache String Path where the image is stored with the filter applied
image.driver String gd o imagick Driver that manipulates the images
cache.path String Path where the files of cache manager will be stored
cache.ttl Integer Life time of the cache in minutes. By default the cache does not have ttl therefore it will never expire.
filters Array Filtration parameters Set the filters with the formats that are applied to the images

Filtration parameters

Parámetro Tipo Valor Descripción
width Integer Image width
height Integer Image height
type String Filter types Type of filter for the image

Tipo de filtros

Tipo Descripción
resize Change the size of the current image according to a width and height
crop Crop a part of the current image with width and height
fit Combine cropping and resizing to format the image in an intelligent way. You will automatically find the most suitable aspect ratio of your width and height determined in the current image, cutting out and changing its size to the given dimension.

Methods

Resolve

Returns the path of the image with the filter applied.

Parameter Description
path Path of the original image that you want to apply the filter
filter Nombre del filtro que se le ha indicado en el parámetro de configuración filters
$imageFilteredUrl = $imageManager->resolve( '/source/image/path/file.jpg', 'image_small' );

Dependencies

About

A simple cache library and image formatting in PHP [WIP]

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages