robbiepaul / cloudconvert-laravel

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

How to get output files after file convert? #54

Open brickgale opened 7 years ago

brickgale commented 7 years ago

the public function 'getOutput()' doesn't return anything. Is there an accessible function that returns an array of strings of the converted file paths. (I'm not saving it on s3 or ftp)

robbiepaul commented 7 years ago

At the moment no. However I may add a way to grab the output in the next version.

You could just do this:

$original_file_path = '/a/path/to/biggles.webm';
$converted_file_path = '/a/new/path/to/new.mp4';
CloudConvert::file($original_file_path)->to($converted_file_path);

Then to grab the file:

$file = file_get_contents($converted_file_path);
brickgale commented 7 years ago

@robbiepaul I am usualy converting doc,ppt, and pdf to '.jpg' or image file. So I'm expecting pages. How do I know how many page a certain file is?

brickgale commented 7 years ago

my workaround is getting all the files on laravel filesystem by File::files($path) then looping through them with 'preg_match' and doing some string manipulations. Hope that there would be a way to get the converted files, atleast by array of filenames.

robbiepaul commented 7 years ago

Yea it's not ideal I know, I've had to do that previously as well. I'm going to leave this open and label it as an enhancement as it's something that needs to be implemented in 3.0

itsdakmar commented 5 years ago

have anyone found the solution for this?. please help me, how do i get converted file name after queued jobs?