file/filter in php

Archived from the Transloadit support forum. Originally posted on October 4, 2013; details may be outdated, see our docs for current behavior. Original thread

How do I write the file/filter robot in php? I’m getting stuck at the square brackets…clearly a jv squad syntax issue!

'files'=>array(
robot=> "/file/filter",
declines=> array(
["${file.size}", ">", "20971520"],
["${file.meta.duration}", ">", "300"]
),
'error_on_decline'=> true
),

Tried this to no effect:

'files'=>array(
'robot'=> "/file/filter",
'declines'=> array(
array("${file.size}", ">", " 71520"),array("${file.meta.duration}", ">", "10")),
'error_on_decline'=> true
),

Hey tola,

have you tried escaping the dollar signs so that they do not get interpreted as variables:

‘files’=>array( ‘robot’=> “/file/filter”, ‘declines’=> array( array(“\${file.size}”, “>”, " 71520"),array(“\${file.meta.duration}”, “>”, “10”)), ‘error_on_decline’=> true ),

Kind regards,
Tim

Co-Founder Transloadit
@tim_kos

I am going to close this ticket for now. Please feel free to reopen it again if you have further questions.

Kind regards,
Tim

Co-Founder Transloadit
@tim_kos

Oh hey man, thanks.

Great product btw.

One off-the-current-subject question - are there such things as filters for videos? Have an idea to try and apply a lime green filter to uploaded videos.

Hey Tola,

you can try it as you can pass ffmpeg parameters directly to the /video/encode robot: https://transloadit.com/docs/conversion-robots#video-encode

I need to double check which filters we have installed, though. Mind trying the lime green filter and then coming back to me?

Kind regards,
Tim

Co-Founder Transloadit
@tim_kos

Fantastic. Will try it this week and get back to you.

Thanks a ton.

Alright, sounds good. Closing this ticket until then!