robbiepaul / cloudconvert-laravel

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

Ability to track the conversion process progress while converting #3

Closed paulofreitas closed 8 years ago

paulofreitas commented 9 years ago

Hello,

I read the README and did a briefly code inspection and I did not noticed any way to start a conversion process and instantly return the Process instance to be able to further inspect the conversion progress while conversion is in progress. Is this feature currently supported? If not, is there any chance to implement that? :)

Thank you for your time.

robbiepaul commented 9 years ago

Yea sure. I'll have a look at implementing it this weekend

robbiepaul commented 8 years ago

Just realised this is still open after a year. I think it's possible with the current release.

I'm thinking something like this:

$cloudconvert = CloudConvert::make('/path/to/image.jpg', 'png'); // starts a process with the API
$cloudconvert->convertFile(); // starts the conversion with the API
$process = $cloudconvert->getProcess(); // returns the Process object
$step = $process->status()->getStep(); // will return the 'step' of the process from the API 
// I believe it will either be `convert` `finished` or `error`

$isFinished = $process->status()->isFinished(); // this is also an option to check if the file has converted

Then when you're happy to download/save the finished file just do:

$cloudconvert->save();

It's untested but should work fine.