robbiepaul / cloudconvert-laravel

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

How i can create a call back request. #24

Closed Bribin closed 8 years ago

Bribin commented 8 years ago

Im using this package in my laravel project. how i can create a callback request from laravel

robbiepaul commented 8 years ago

What have you tried? Have you tried the example in the readme?

Bribin commented 8 years ago

$Cataloguefile = $request->file('file'); $rand = rand ( 1 , 10000 ); $path = asset('/catalogue/'); CloudConvert::file($Cataloguefile)->convert( $path.$rand.'.jpg'); this is my code. i tried same as example .

robbiepaul commented 8 years ago

Hmm, it's not the same as the example. You need to provide a callback url, it says this in the readme.

Non-blocking conversion using a callback URL

When the conversion might take a long time you could use:

# Script: send_conversion.php
CloudConvert::file('/a/path/to/file.mov')
            ->callback('http://myserver.com/save_file.php')
            ->convert('mp4');

# Script save_file.php
CloudConvert::useProcess($_REQUEST['url'])
            ->save('/path/converted.mp4');
Bribin commented 8 years ago

$rand = rand ( 1 , 10000 ); $path = asset('/catalogue/pdf/'); CloudConvert::file($Cataloguefile)->callback('http://myproject.dev/dashboard/AddCatalogue/save') ->convert( $path.$rand.'.jpg');

this is callback request public function catelogueSave() { $path = asset('/catalogue/pdf/'); $rand = rand ( 1 , 10000 ); CloudConvert::useProcess($_REQUEST['url'])->save($path.$rand.'.jpg'); }

thanks for your help

robbiepaul commented 8 years ago

It won't work with local dev URLs, because the CloudConvert servers need to be able to make a request to it. If you upload it to a live site it will work

Bribin commented 8 years ago

oke. thanks you