tiix / image-manager
There is no license information available for the latest version (dev-master) of this package.
Image manager
dev-master
2017-01-11 14:14 UTC
Requires
- php: ~5.5|~7.0
- intervention/image: ^2.3
Requires (Dev)
- jolicode/jolinotif: ^1.0
- phpunit/phpunit: ^4.8
This package is auto-updated.
Last update: 2025-01-12 14:50:18 UTC
README
Installation
composer require tiix/image-manager
Usage
$storage = new \Tiix\ImageManager\Storage\LocalStorage('/path/to/storage'); $webPathLocator = new \Tiix\ImageManager\WebPathLocator\DefaultWebPathLocator('http://google.ru/path/'); $resizedNamingStrategy = new \Tiix\ImageManager\ResizedNamingStrategy\DefaultResizedNamingStrategy(); $resizer = new \Tiix\ImageManager\Resizer\InterventionResizer( new \Intervention\Image\ImageManager(), $resizedNamingStrategy ); $imagesManager = new \Tiix\ImageManager\ImageManager( $storage, $webPathLocator, $resizer ); // saving image $imagesManager->save(file_get_contents('path/to/image.jpg'), 'image-name.jpg'); // get web path to image echo $imagesManager->webPath('image-name.jpg'); // http://google.ru/path/image-name.jpg // get relative path to image echo $imagesManager->webPath('image-name.jpg'); // /path/image-name.jpg // get resized web path to image echo $imagesManager->webPathResized('image-name.jpg', 100, 100); // http://google.ru/path/image-name100x100.jpg // get resized relative path to image echo $imagesManager->relativeWebPathResized('image-name.jpg', 100, 100); // /path/image-name100x100.jpg