robbiepaul / cloudconvert-laravel

A Laravel wrapper for the CloudConvert API
177 stars 34 forks source link

How to enable CacheControl while uploading to Amazon S3 #33

Closed AmirAmin closed 8 years ago

AmirAmin commented 8 years ago

Hello,

I have two questions:

1) How can i enable CacheControl while uploading to Amazon S3? as it saves a lot of money on the long run.

2) Does CloudConvert have watermark feature ? for example if i want to add a watermark or website name on the converted images.

Best Regards, Amir Amin

josiasmontag commented 8 years ago

1) It is supported by CloudConvert itself, but I am not sure if the laravel wrapper has this functionality yet. See https://cloudconvert.com/api/s3 (output.s3.cachecontrol) 2) Watermarking is currently not supported by CloudConvert.

robbiepaul commented 8 years ago

Yeah you can just add it to the list of output arguments, if we use the same example from yesterday it would be:

CloudConvert::file('http://www.gnfiliaton.gr/sites/default/files/20131231103232738561744.pdf')
            ->withOptions([
                'quality' => 80,
                'resize' => '500x400',
                'resizemode' => 'crop' // (optional) or 'scale' 
            ])
            ->callback('http://url.com/callback')
            ->convert( CloudConvert::S3('jpg', [
                'path' => 'uploads/catalogue/issue/',
                'cachecontrol' => 'max-age=172800'
            ]));

For watermarking perhaps use the Intervention Image package in conjunction with Laravel's cloud storage file system (see the docs)

AmirAmin commented 8 years ago

Thanks Brothers,

@robbiepaul It worked perfect, But it has to be 'CacheControl' not 'cachecontrol' as the lowercase will return the following error message: "Saving to S3 failed: Unexpected key 'cachecontrol' found in params (Code: UnexpectedParameter)"

I will check Intervention Image package for the watermark.

Thanks again

robbiepaul commented 8 years ago

Glad it worked!