Skip to content

“We don't make mistakes, just happy little accidents.”

License

Notifications You must be signed in to change notification settings

magroski/bob-ross

Repository files navigation

Bob Ross

This library provides an easy way to upload, manipulate and persist images.

Latest Stable Version Minimum PHP Version CircleCI GitHub license

Bob Ross

“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');

About

“We don't make mistakes, just happy little accidents.”

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages