Help with /file/filter

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

Hi there

We’re trying to add a simple filtering step that will reject images below a certain size as they are uploaded. I’ve put the following template together, but it accepts all the images I send into it, despite being below the threshold. Help.

{ "steps": {
    "sizefilter": {
      "robot": "/file/filter",
      "error_on_decline": true,
      "declines": [
        ["${file.width}","<","800"],
        ["${file.height}","<","800"]
      ]
    },
    
    "store": {
      "robot": "/s3/store",
      "key": "REDACTED",
      "secret": "REDACTED",
      "bucket": "media.actlocalmedia.com"
    }
} }

My test image is 229x229 yet the assembly executes successfully and stores the file to s3. What am I doing wrong?

Thanks

Hey there,

please use ${file.meta.width} and ${file.meta.height}.

Kind regards
Tim

Thanks! You might want to add a note to the docs reminding people about using file.meta.property and not file.property – it does say that, but I missed it (obviously) for several hours last night :slight_smile:

Hehe, thanks for the tip, will do :slight_smile:

Kind regards,
TIm

Hey there,

I have updated the docs to make this more clear: http://transloadit.com/docs/file-filter
The content is now wrapped in a nice info box.

Thanks again for the hint!

Closing again