Crop
PHP Component to resize images from a configuration file
Easy install with a single line of code
composer require femtopixel/crop
Usage
<?php
$formats = array(
'mini' => array(
'width' => 100,
'height' => 100,
'full' => 'cropped',
),
);
$image = new \FemtoPixel\Crop\Crop('/path/to/file.png', 'mini');
$image->setFormatsFromArray($formats)->render();
You can define as many format that you want!
- First parameter is path to your file to display
- Second (optional) is the format you want to display in (default : 'original' (no modification))
- Third (optional) is path to default image displayed if path in first parameter doesn't exist. This file will be displayed in requested format. (default : 'src/missing.png')
More detailed information
If you want to support my work, you can spread it or considering donation :