Closed chrisbell08 closed 8 years ago
Hi Chris,
Yeah if you're using a callback url then you use convert
instead of to
as the latter will actually attempt to save the converted file in the same process.
What's the exact error message you receive? Have you tried the same options on CloudConvert's API Console?
Hi,
Really appreciate the help!
I had a play around with the console and looked through the Cloud Convert docs but from what I can tell you should pass the S3 details in the initial request along with the callback url it's all under Output parameters but I can't find a way to do this in this library.
I think to get it to work it needs a way of passing in the S3 method to the initial request without using the to method.
Maybe a withOutput method would be handy where you could provide custom paramaters for the output array
Hi Chris,
You should be able to use withOptions
with callback
Can you paste the error message your receiving?
Also if you could post both parts of the code you're using that would help in debugging it. The part where you start the process with callback plus the code in the callback script.
Thanks
Is it easier for me to show what i'm trying to do? I may just be doing it wrong. This is the output i'm trying to create:
[
"input" => "download",
"file" => "https://s3-us-west-2.amazonaws.com/interactrapp/jvpage/jvvideo/pink.mp4",
"output" => [
"s3" => [
"accesskeyid" => "my_key",
"secretaccesskey" => "my_secret",
"bucket" => "my_bucket",
"region" => "us-east-1",
"path" => "video.webm",
],
],
"converteroptions" => [
'thumbnail_count' => '1',
'thumbnail_size' => '203x113',
'thumbnail_format' => 'png'
]
"callback" => "http://mycallback.com",
];
That's perfect, here's the code you need to create that:
CloudConvert::file('https://s3-us-west-2.amazonaws.com/interactrapp/jvpage/jvvideo/pink.mp4')
->callback('http://mycallback.com')
->withOptions([
'thumbnail_count' => '1',
'thumbnail_size' => '203x113',
'thumbnail_format' => 'png'
])
->convert( CloudConvert::S3('video.webm') );
And if you want to put the converted file in a different bucket or region to the one in your config file:
CloudConvert::file('https://s3-us-west-2.amazonaws.com/interactrapp/jvpage/jvvideo/pink.mp4')
->callback('http://mycallback.com')
->withOptions([
'thumbnail_count' => '1',
'thumbnail_size' => '203x113',
'thumbnail_format' => 'png'
])
->convert( CloudConvert::S3('video.webm', [
'bucket' => 'my_bucket',
'region' => 'us-east-1'
]));
Perfect! My issue was I was passing the file type into the convert method as a string (I think it's like that in one of the examples). Didn't no you could pass S3 stuff in there.
Works perfect now thanks!
Yea I think I'll add a more detailed use case like this as an example in the readme.
Glad it works
yeah I think people will find that useful.
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).
The only way I can get the process to start without throwing an error is:
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?