robbiepaul / cloudconvert-laravel Goto Github PK
View Code? Open in Web Editor NEWA Laravel wrapper for the CloudConvert API
A Laravel wrapper for the CloudConvert API
I am trying to use non-blocking conversion, but it does not seem to work for me. Could you help me? Here is the code I am using:
public function postSendPost() {
$files = $request->file("file");
foreach($files as $file){
CloudConvert::file($file)->callback('https://mywebsite.com/feed/completeVideoConversion')
->convert('mp4');
}
}
public function getCompleteVideoConversion() {
$rand = rand ( 1 , 10000 );
CloudConvert::useProcess($_REQUEST['url'])->save(CloudConvert::s3($rand.'.mp4'));
}
I have checked that process is created and I am able to download the file via the download url from cloudconvert server, but is not saving on S3.
Thanks for your help in advance.
"Your requirements could not be resolved to an installable set of packages."
I see this has been a poblem before, can you update the code please?
Hi
Is it possible to integrate this library with Lumen framework?. If yes, can you please provide steps?.
Thanks
I'm trying to convert .flv to .mp4.
When uploading:
CloudConvert::file($file)->to(CloudConvert::S3($id.'.mp4'));
Everything seems to work fine, but when I download and open the generated file it seems to be in flv format still 😕.
When manually converting it on the site itself, I get the correct video in flv format.
Any guidance would be appreciated.
Hello,
I have two questions:
How can i enable CacheControl while uploading to Amazon S3? as it saves a lot of money on the long run.
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
Hello,
Right now converting from PDF to JPG creates Multiple output files.
So, Is there a method to deal with output.files instead of downloading the zip file?
https://cloudconvert.com/api/conversions#snippetDownloadMultipleRaw
Regards,
Hi,
We've been having problems with conversionTypes()
method. We used it like this:
$types = CloudConvert::input('jpg')->conversionTypes();
and it worked fine. After composer update
we get a fatal error. Basically, CloudConvert->getOutputFormat()
suddenly fails.
Took us a while to understand what is going on, because for some of the team members the code worked, for others - not. Turned out that some of us had newer version of your package and for those the fatal error occurred.
Anyway, seems like it all comes down to the change, where this line
return isset($this->output) ? $this->getOutput()->getFormat() : $this->output_format;
changed to this one:
return !isset($this->output_format) ? $this->getOutput()->getFormat() : $this->output_format;
It's hard at this point to be more specific, but hopefully it's enough for you to take a look at possible problems.
Hi, I understand this is not completely related to this API but I would like to ask for your help. Is there any way to pass parameters from callback function to client size and notify the user when conversion is completed?
I would really appreciate any help.
Thanks.
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)
Hey,
I need to access the process ID when I make a request so I can save it to a DB and do some stuff with it when the callback comes back from cloud convert. The only way I can do this is by changing the $process property on the cloud convert class to public then doing this:
$cloudconvert = CloudConvert::file($url)->withOptions([
'thumbnail_count' => '1',
'thumbnail_size' => '203x113',
'thumbnail_format' => 'png'
])->callback(env('SITE_URL') . '/events/videoConverted')->convert('webm');
$processId = $cloudconvert->process->id;
The only issue with this is that i've had to override something in your core library which isn't ideal as I would then have to prevent it from updating.
Is there currently a better way to access the ID? If not would it be possible to add this in?
Hey,
Thanks for putting this repo together, saved me a ton of time getting the integration with cloud convert working.
Is it possible to also push the video thumbnail up to s3 with a converted video?
I'm converting an mp4 to webm and have seen in the cloud convert docs you can get the thumbnail, I assume using the withOptions method but not sure how I would then push it up to s3 with the video.
Cheers
Hi,
I've installed this components using composer on Laravel 5 but I can't get it to work.
All I get for every request is "No API key provided." even though I've set them in config/cloudconvert.php.
I've tried re-installing multiple times but always end up with the same results.
Any ideas?
occurs:
CloudConvert::file($path)
->callback(url() . '/api/notifications/convert/videos')
->to('ogg');
Hello,
Right now, I am using this package to convert PDF to JPGs, and it is doing a wonderful job.
My Question is: Is there a option to create Tumbs/Thumbnails from the pictures as well?, so the callback for ex. would return the normal image, and its thumbnail.
Note: I need this function as i am creating flipping book from the returned images, and i want the thumbnails for the TOC.
Regards,
Amir Amin
HI there,
Looks like you might need to update all the old Share references to Singleton for compatability.
As per: laravel/framework@1a1969b
No time to pull req at the mo :(
Hey, i have some issues when I'm converting my files. The Image-Files are resizing correctly, but the density won't change to 72.
Here is my code.
CloudConvert::file('upload/'.$filename)->withOptions([ 'resize' => $newWidth.'x'.$newHeight, 'density' => '72' ])->to('files/img/'.$fn.'.jpg');
I'm using Laravel 4.2
Hello,
There is a method to extract file metadata from PDF, image, video and audio files, is it included in this package? and how to use it.
For more details about it, kindly check the following link:
https://cloudconvert.com/api/info
Regards,
Hi, cheers for making this!
I'm having a problem getting queues to work with Amazon S3. When I do this:
CloudConvert::file(asset(Storage::url($path)))->queue('to', CloudConvert::S3($thumb_full_name));
I get back this error: {"error":"This conversiontype is not supported! (pdf to AKIAJTZQLLWBR2GD72OQ)","code":400}
If I change the file name from the variable to test.jpg I still get that error. Should I be using the queue method in a different way to get it to work?
Cheers!
I'm using Laravel5.2, there is already guzzlehttp on vendor folder. I'm not sure why is it giving me SSL certificate problem when I'm still doing it on local. Do we need SSL for calling the api of Cloud Convert?
I'm following the implementation provided here. To test it, I call /convert
URL on my server. The robots.txt file is being converted correctly, but is not stored back on the server as PDF using the callback function.
The code:
/* /convert */
public function convert() {
CloudConvert::file(public_path('robots.txt'))
->callback('http://my-public-server.com/convert-save')
->convert('pdf');
}
then
/* /convert-save callback */
public function convertSave() {
CloudConvert::useProcess(Request::input('url'))
->save(public_path('robots.pdf'));
}
Both /convert and /convert-save are public, reachable URLs.
Anything wrong with my implementation? Anything I'm missing?
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.
Is it possible to use this wrapper to create a thumbnail from a video that's already stored on S3? I'm looking at the API docs of CloudConvert, and it seems possible to do it using the normal PHP library, but it seems this wrapper expects an output to be given.
When you try to convert a docx to a pdf using the templating method, there is a problem with accents.
I found the line that cause the problem :
File : \RobbieP\CloudConvertLaravel\HttpClientAdapter\Guzzle6Adapter
Method : castContents
line: 188
Simply by removing the utf8_encode
, it works
I'm wondering why it need to be encoded in uft8, and if by removing the part of code it will not create an other bug.
Thanks
Hi,
I am trying to create a thumbnail. It works perfectly fine until I add command(), then video is created but folder and image is not created. Do you know how to resolve this issue? Maybe I am doing something wrong, or it is expected behaviour?
Here is my code:
$width = 1280;
$height = 720;
$basename = rand ( 1 , 10000 );
$cloudConvert = CloudConvert::file($file)
->command('-i {INPUTFILE} -filter:v "scale=iw*min('.$width.'/iw\,'.$height.'/ih):ih*min('.$width.'/iw\,'.$height.'/ih), pad='.$width.':'.$height.':('.$width.'-iw*min('.$width.'/iw\,'.$height.'/ih))/2:('.$height.'-ih*min('.$width.'/iw\,'.$height.'/ih))/2" {OUTPUTFILE}')
->withOptions([
'thumbnail_count' => '1',
'thumbnail_size' => '640x480',
'thumbnail_format' => 'png' ])
->callback('https://url.com')
->convert(CloudConvert::s3($basename.'.mp4'));
Any help would be highly appreciated. Thanks
I found your instructions great, got it installed, but came up with this error.
It took me a day or so trying to figure it out before consulting the gurus on IRC. I'm quite new to Laravel, so it didn't occur to me that you need to add the class to your controller before you can use it (now it seems obvious).
For anyone else trying to solve this, you need to add the following to the top of your page:
use RobbieP\CloudConvertLaravel\Facades\CloudConvert;
I'd recommend adding this into your readme just above the part you mention "Now you can use CloudConvert in your application!".
Thanks for your app!
Im using this package in my laravel project. how i can create a callback request from laravel
Thank you for the package.
How can I convert file using Symfony Uploaded file as an input and saving it somewhere else?
app('cloudconvert')->file($uploadedFile)->to('pdf', true)->save(storage_path())
Client error:
GET https://host123d1qp.cloudconvert.com/download/~qPUuwEqiICsPI4AKiI1B-iUBtXY
resulted in a400 Bad Request
response:
{"error":"This process does not have any output files.","code":400}
When passing converter options as an array in the following way, Guzzle throws an exception.
$instance = CloudConvert::newInstance()
->file($from)
->withOptions($options)
->callback($callbackUrl)
->convert($to);
The exception is:
Invalid resource type: array
And it's occurring in at GuzzleHttp\Psr7\stream_for(array('resize' => '4000')) in MultipartStream.php line 87
Could it be related to this? guzzle/guzzle#1079
Can you confirm that passing options as an array is still supported?
I'm not having any luck converting an uploaded Powerpoint file to PDF. I'm using L5. The uploaded file doesn't have an extension so CC returns a cannot convert this format error message. I have made several changes to the library code with no luck. Now I'm running in circles...
Any help???
I have noticed that inside your service provider you run
$this->app['cloudconvert'] = $this->app->share(function($app)
{
return new CloudConvert(config('cloudconvert'));
});
which means that each time I call a method via the facade the same instance of RobbieP\CloudConvertLaravel\CloudConvert
is given back.
On line 308 of CloudConvert.php you check to see if the resource is empty before setting it and if not you don't set the resource again. This means that you can only ever upload and convert one file. If you attempt to upload multiple files, the first file will be re-uploaded and converted multiple times.
I tried to convert any videos from users upload to mp4.
1.) Is that mp4 always take care the best conversion bit rate and small size and will that video support all browsers like safari, IE, Chrome, Firefox, Opera, etc...
in my code
CloudConvert::file($uploadedFile->getRealPath())->quality(70)->to(CloudConvert::S3('users/videos/'.$timestamp.".mp4"));
Error I got
Non-static method RobbieP\CloudConvertLaravel\CloudConvert::file() should not be called statically
I have been trying in vein to say a file to S3 as part of a callback.
The code I have tried is:
CloudConvert::useProcess($processUrl)
->save(CloudConvert::S3('some/aws/key.pdf'));
No errors are thrown. It simply doesn't upload the file. Is this something which is supported?
As a temporary workaround I use the following code:
$cloudConvert = CloudConvert::useProcess($processUrl);
$file = $cloudConvert->getProcess()->download();
Storage::put('some/aws/key.pdf', $file);
Thanks, Ian
Hi Team,
Thanks for the excellent plugin. Am trying to convert PDF to JPG where multiple images are converted and received. I just need to know how to save all the files to a specific folder, My code
CloudConvert::file('http://test.com/Test.pdf')->to('jpg');
Also I tried,
CloudConvert::file('http://test.com/Test.pdf')->to('jpg', ['path' => $filePath]);
Everything saves in public folder and unable to route to a specific folder inside my web application. Is it possible to save all files inside specific folder?
Hi, I am trying to convert file from input and save it on S3.
CloudConvert::file($file)->to(CloudConvert::S3('hello.mp4'));
For some reason it treats s3 as an output format and gives me an error:
{"error":"This conversiontype is not supported!","code":400}
Client->request('post', 'https://api.cloudconvert.com/process', array('json' => array('inputformat' => 'mp4', 'outputformat' => 's3', 'apikey' => 'apikey'), 'synchronous' => true))
I am really struggling here, I would appreciate any help. Thanks
Hi, thanks for this repo...really helpful. I implemented it and it works great for images, and pushes them to s3 just fine. But when I try any vide, I get "Could not be converted". Anyone had this issue before and any ideas what caused it?
/** store function in the controller **/
public function store()
{
if (Input::hasFile('photo')){
CloudConvert::file(Input::file('photo'))->convert(CloudConvert::S3('TestVideo.webm'));
return redirect('/upload');
}
}
/** upload form in view **/
{!! Form::open(['action' => 'UploadController@store', 'method'=>'POST', 'files' => true]) !!}
<div class="form-group">
{!! Form::label("photo", "Upload Image:") !!}
{!! Form::file("photo", null, ['class'=>'form-control']) !!}
</div>
<div class="form-group">
{!! Form::submit("Create", ['class'=>'btn btn-success pull-right']) !!}
</div>
{!! Form::close() !!}
This works well for images, both saving to a local folder and to s3, but I get this "Count not be converted" message for videos. My test video is 1minute in length.
Thanks in advance for any help.
Hi.
I'm trying to install this package to a Laravel 5.1 project. Unfortunately, Composer refuses to install the package.
Your requirements could not be resolved to an installable set of packages.
Problem 1
- Installation request for robbiep/cloudconvert-laravel 2.* -> satisfiable by robbiep/cloudconvert-laravel[v2.1].
- Conclusion: remove laravel/framework v5.1.1
- Conclusion: don't install laravel/framework v5.1.1
- robbiep/cloudconvert-laravel v2.1 requires illuminate/filesystem 5.0.*@dev -> satisfiable by illuminate/filesystem[v5.0.0, v5.0.22, v5.0.25, v5.0.26, v5.0.28, v5.0.33, v5.0.4].
- don't install illuminate/filesystem v5.0.0|don't install laravel/framework v5.1.1
- don't install illuminate/filesystem v5.0.22|don't install laravel/framework v5.1.1
- don't install illuminate/filesystem v5.0.25|don't install laravel/framework v5.1.1
- don't install illuminate/filesystem v5.0.26|don't install laravel/framework v5.1.1
- don't install illuminate/filesystem v5.0.28|don't install laravel/framework v5.1.1
- don't install illuminate/filesystem v5.0.33|don't install laravel/framework v5.1.1
- don't install illuminate/filesystem v5.0.4|don't install laravel/framework v5.1.1
- Installation request for laravel/framework == 5.1.1.0 -> satisfiable by laravel/framework[v5.1.1].
I think it may be as simple as bumping your "illuminate/filesystem": "5.0.*@dev"
line in composer.
Thanks!
CloudConvert::file($this->url)
->withOptions([
'thumbnail_count' => '1',
'thumbnail_size' => '600x315',
'thumbnail_format' => 'jpeg',
])->info();
The above is just timing out. was working fine until a few days ago and has now broken on two separate apps... Think it may be a cloud convert thing. I'm Investigating now....
Hi guys,
i want to convert video file .mov to mp4 but i don't know how i will set the resolution and buffer size for output file.
Thanks
CloudConvert::file('/public/uploads/gdtbgds125846.mov')->to('/public/convert/gdtbgds125846.mp4');
Hey,
I've having some trouble getting the library working when trying to add the s3 options to the output array along with the a callback url.
This way throws an error saying process already started but cloud convert still uploads the files to S3 and makes the callback to the URL (So it does actually work but crashes my code with the errror).
$cloudconvert = CloudConvert::file($url)->withOptions([
'thumbnail_count' => '1',
'thumbnail_size' => '203x113',
'thumbnail_format' => 'png'
])->callback('http://requestb.in/1n48f3k1')->to(CloudConvert::S3($output) );
The only way I can get the process to start without throwing an error is:
$cloudconvert = CloudConvert::file($url)->withOptions([
'thumbnail_count' => '1',
'thumbnail_size' => '203x113',
'thumbnail_format' => 'png'
])->callback('callback_url')->convert('webm')
I've tried to then push to s3 on the callback url using the useProcess method but keep getting an output format does not match format provided error. I think this may be to do with the output file actually being 2 files the png thumbnail and the webm file. If I view the details url it shows the two files and a .zip file too. When using the "to" method to push to s3 when starting the process it works fine I just can't get it to work in the callback. Or get the initial process to accept the S3 options without erroring.
Does this make sense?
Hi,
When attempting to convert a file by passing the file upload object Symfony\Component\HttpFoundation\File\UploadedFile
, the conversion fails with bad request.
I did some digging into it, and it seems there are multiple issues. Firstly, in the ConvertLocalFile
class if its an instance of UploadedFile
you run $this->setFile($file->getFilename());
. This only gives the filename and not the path on disk. I believe it should be set to $this->setFile($file->getPathname());
.
This still doesn't solve the issue of setting the file extension as getPathname
returns a temporary path which doesn't contain the extension. I tried adding $this->setFormat($file->getClientOriginalExtension());
under where you set the filename and this seemed to solve the first issue.
However, later is still fails with 400 "Bad Request". If I visit the process url it gives back a json object including the error "File not found (Upload failed)".
I am unsure how to solve this.
The changes I made are:
function __construct($file, $converteroptions = null)
{
parent::__construct($file, $converteroptions);
$this->setMethod(CloudConvert::INPUT_UPLOAD);
$this->setFilesystem();
if($file instanceof UploadedFile) {
$this->setFile($file->getFilename());
$this->setFormat($file->getClientOriginalExtension());
}
}
Hello,
Right now i would like to run a conversion command and return the process id to store it in the database, to compare it in the callback to get the download url for the process in case i am running more than one conversion.
Regards,
Hello!
How to set the encoding?
I use:
$variables = ['template' => 'шаблон_1 kjf'];
CloudConvert::file(public_path().'/files/otch.docx')->templating($variables)->to('pdf');
and get http://clip2net.com/s/3AhDTAc
I tried "mb_convert_encoding", "iconv" but this not helped me.
I have a freshly installed Laravel 5. Installing "robbiep/cloudconvert-laravel": "~2.0" give me the following error, Your requirements could not be resolved to an installable set of packages.
Hi I came here across a long search after my requests.
I am using Laravel 5.2
What I am looking for is.
I have one PDF file witch is 50 page.
I need to convert all to two types of images
type one
skip the first image, and start from the second
and combined it with the third, and so on combing 4-5 and 6-7, 8-9 ....
then store them into my database.
type two just convert the PDF to images and store it in my database.
Can this package help me doing so??
Regards
CASE 1
I'm running Laravel 5.1.6. I follow the install instructions for Laravel 5+ from the GitHub project. After the "robbiep/cloudconvert-laravel": "2.*" dependency is added to composer.json, I run composer update
and I get the following error: http://i.imgur.com/zhU3WXU.jpg.
Basically, it claims that the BroadcastServiceProvider is missing, which is actually correct. The provider files are gone after your package is required and tried to be installed.
The BroadcastServiceProvider is a part of upgrate to Laravel 5.1: http://laravel.com/docs/5.1/upgrade#upgrade-5.1.0.
CASE 2
When I try composer install
instead, the process is successful, but the CloudConvertLaravelServiceProvider is not created, file of this name does not exist in the project. Then, running php artisan vendor:publish
throws this: Class ''RobbieP\CloudConvertLaravel\CloudConvertLaravelServiceProvider'' not found.
Not really sure what is going on. Maybe the documentation on GitHub is not up to date. Maybe I'm doing something incorrectly. In any case, would be nice to get an answer or suggestions. Thanks!
When i converting my document from docx to pdf. i have this error 'cURL error 7: Failed to connect to api.cloudconvert.com port 443: Connection refused (see http://curl.haxx.se/libcurl/c/libcurl-errors.html)'
What should I do ?
Sorry i am bad in English
Thanks
Dandy F
I am using callback function and I want to notify the user when conversion is finished. How to retrieve the process id which is finished with callback? Will multiple conversions will work at the same time?
Thank you in advance.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.