magroski / bob-ross
An easy way to upload, manipulate and persist images.
Installs: 12 805
Dependents: 0
Suggesters: 0
Security: 0
Stars: 0
Watchers: 2
Forks: 1
Open Issues: 0
Requires
- php: ^7.1 || ^8
- aws/aws-sdk-php: ^3.27
Requires (Dev)
- object-calisthenics/phpcs-calisthenics-rules: ^3.1
- phpstan/phpstan: ^0.10.0
- phpunit/phpunit: ^7.5
- roave/security-advisories: dev-master
- slevomat/coding-standard: 4.5
- squizlabs/php_codesniffer: *
README
This library provides an easy way to upload, manipulate and persist images.
“We don't make mistakes, just happy little accidents.” - Bob Ross
Usage examples
Upload from multiple sources
$persistenceHandler = new LocalFileSystem(); $painter = new Painter($persistenceHandler); # From upload form ($_FILE) $painter->loadFromFileGlobal('profile_pic'); # From file system $painter->loadFromFileSystem('/home/bob/images/happy_trees.png'); # From Uri $painter->loadFromUri('https://joyOfPainting.com/bob.png');
Persist to different environments
# Amazon S3 $s3Handler = new S3(new Config('credentials','key','region)); $painter = new Painter($s3Handler); $painter->save('myFolder'); # Local $localHandler = new LocalFileSystem(); $painter = new Painter($localHandler); $painter->save('myFolder');
Do size manipulations
$localHandler = new LocalFileSystem(); $painter = new Painter($localHandler); $painter->loadFromFileSystem('/home/img/tree.png'); $painter->saveFixedWidth(1200, '/home/img'); $painter->saveFixedHeight(800, '/home/img'); $painter->saveMaxWidhtHeight(1920, 1080, 'home/img'); $painter->saveThumb(200, 200, '/home/img');
Convert between formats
$localHandler = new LocalFileSystem(); $painter = new Painter($localHandler); $painter->loadFromFileSystem('/home/img/tree.png'); $painter->setImageCovert('bmp'); $painter->save('/home/img');
Change Jpeg quality
$localHandler = new LocalFileSystem(); $painter = new Painter($localHandler); $painter->loadFromFileSystem('/home/img/tree.png'); $painter->setJpegQuality(50); $painter->save('/home/img');