library client
Image scaling with AWS S3 and Lambda
clownfish/client
Image scaling with AWS S3 and Lambda
- Monday, May 15, 2017
- by ponyfleisch
- Repository
- 1 Watchers
- 0 Stars
- 224 Installations
- PHP
- 0 Dependents
- 0 Suggesters
- 0 Forks
- 0 Open issues
- 1 Versions
- 0 % Grown
usage
$secret = 'sharedsecret';
$s3 = 'imghosting-foo';
$cloudfrontRoot = 'https://d2rrvpvpaaof6s.cloudfront.net';
// pass bucket name and region. credentials optional.
$service = new Clownfish\Service($s3, 'ap-southeast-1', ['key' => 'foo', 'secret' => 'bar']);
// upload image
$image = $service->uploadImage('foo.jpg', 'article', 1);
// originalFilename is your reference with which you can recreate the Image Object
$originalFilename = $image->getFilename();
// output scaled version
$image = new Clownfish\Image($originalFilename);
$scaledImage = $image->getScaledImage(100, 100, $secret);
$scaledUrl = $cloudfrontRoot . $scaledImage->getPath();
echo $scaledUrl."\n";
dev-master
9999999-dev
Image scaling with AWS S3 and Lambda
Sources
Download
MIT
The Requires
by
Claudio Mettler