2017 © Pedro Peláez
 

library ys-tinify-laravel

Tinify API support with laravel

image

yasmuru/ys-tinify-laravel

Tinify API support with laravel

  • Thursday, January 25, 2018
  • by yasmuru
  • Repository
  • 2 Watchers
  • 10 Stars
  • 1,603 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 2 Forks
  • 0 Open issues
  • 4 Versions
  • 22 % Grown

The README.md

ysTinify-laravel

Tinify API support with laravel, (*1)

Latest Version on Packagist, (*2)

Install

``` bash $ composer require yasmuru/ys-tinify-laravel, (*3)


Add this to your config/app.php, under "providers": ```php yasmuru\LaravelTinify\LaravelTinifyServiceProvider::class,

under "aliases":, (*4)

        'Tinify' => yasmuru\LaravelTinify\Facades\Tinify::class

And set a env variable TINIFY_APIKEY with your tinypng api key., (*5)

If you want to directly upload the image to aws s3, you need set the env variables of following with your aws s3 credentials., (*6)

    S3_KEY=
    S3_SECRET=
    S3_REGION=
    S3_BUCKET=

Examples

    $result = Tinify::fromFile('\path\to\file');


    $result = Tinify::fromBuffer($source_data);

    $result = Tinify::fromUrl($image_url);

    /** To save as File **/
    $result->toFile('\path\to\save');

    /** To get image as data **/
    $data = $result->toBuffer();

$s3_result = Tinify::fileToS3('\path\to\file', $s3_bucket_name, '/path/to/save/in/bucket'); $s3_result = Tinify::bufferToS3($source_data, $s3_bucket_name, '/path/to/save/in/bucket'); $s3_result = Tinify::urlToS3($image_url, $s3_bucket_name, '/path/to/save/in/bucket'); /** To get the url of saved image **/ $s3_image_url = $s3_result->location(); $s3_image_width = $s3_result->width(); $s3_image_hight = $s3_result->height();

NOTE: All the images directly save to s3 is publicably readable. And you can set permissions for s3 bucket folder in your aws console to make sure the privacy of images., (*7)

The Versions

25/01 2018

dev-master

9999999-dev

Tinify API support with laravel

  Sources   Download

MIT

The Requires

 

by Avatar yasmuru

laravel tinypng tinify

25/01 2018

v1.0.2

1.0.2.0

Tinify API support with laravel

  Sources   Download

MIT

The Requires

 

by Avatar yasmuru

laravel tinypng tinify

16/11 2016

v1.0.1

1.0.1.0

Tinify API support with laravel

  Sources   Download

MIT

The Requires

 

by Avatar yasmuru

laravel tinypng tinify

15/11 2016

1.0

1.0.0.0

Tinify API support with laravel

  Sources   Download

MIT

The Requires

 

by Avatar yasmuru

laravel tinypng tinify