Download the PHP package anakadote/image-manager without Composer
On this page you can find all versions of the php package anakadote/image-manager. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download anakadote/image-manager
More information about anakadote/image-manager
Files in anakadote/image-manager
Package image-manager
Short Description Image resizing and cropping package for Laravel.
License MIT
Informations about the package image-manager
Image Resizing and Cropping Package for Laravel
This Laravel package provides a convenient way of resizing and cropping images.
Begin by installing this package through Composer via the terminal.
composer require anakadote/image-manager
Next, add the service provider. Open config/app.php
and add a new item to the providers array.
Anakadote\ImageManager\ImageManagerServiceProvider::class
The final step is to use artisan to move the package assets to the public directory, also from the Terminal:
php artisan vendor:publish --provider="Anakadote\ImageManager\ImageManagerServiceProvider"
Usage
This package is accessible via a Laravel Facade so to use simply call its methods on the Facade "ImageManager".
getImagePath($filename, $width, $height, $mode, $quality = 90)
Example 1: Resize or crop an image and get the newly generated image's web path.
Example 2: Use an HTML picture element to display a webp version of the image, if supported by the browser.
The getImagePath() method has six parameters, the first four of which are required:
-
File Name (string) The fully qualified name of image file. The file must reside in your app's
public
directory. You'll need to grant write access by the web server to thepublic
directory and its children. -
Width (integer) Desired width of the image.
- Height (integer) Desired height of the image.
-
Output Mode (string) The output mode. Options are:
- crop - Crop from the vertical middle.
- crop-top - Crop from the top.
- crop-bottom - Crop from the bottom.
- fit - Fit while maintaining aspect ratio.
- fit-x - Fit to the given width while maintaining aspect ratio.
- fit-y - Fit to the given height while maintaining aspect ratio.
- Image Quality - (integer, 0 - 100) Default value is 90.
- Format - (string) Convert the image to the given format/extension, e.g. "webp";
getUniqueFilename($filename, $destination)
Generate a unique file name within a destination directory — uses the original file name as the basis for the new file name.
The getUniqueFilename() method has two parameters: the original filename, and the destination path.
deleteImage($filename)
Delete an image including all resized and/or cropped images generated from it.
The deleteImage() method has a single parameter which is the fully qualified name of the original image file. This method will recursively delete all generated images from the original image file.
All versions of image-manager with dependencies
illuminate/support Version >=5.0
enshrined/svg-sanitize Version ^0.15.4