Button for image file upload

To add an image upload button to the task, use the {{field type= "file-img" name= " <field ID>"}} component. Field ID must match the field name in the output data description. After the image is uploaded the performer will see an icon for image preview. For example:

{{field type="file-img" name="photo" camera=true}}
Full list of parameters

Parameter

Description

Required

Default value

type

Field type: file-img — Button for image file upload.

yes

no

name

Field ID. Must match the field name in the output data description.

yes

no

validation-show

The position of popup hints (displayed if the response didn't pass validation). The position is relative to the input field.

Supported values:

  • Above the input field: "top-left", "top-center", "top-right".

  • Below the input field: "bottom-left", "bottom-center", "bottom-right".

  • To the left of the input field: "left-top", "left-center", "left-bottom".

  • To the right of the input field: "right-top", "right-center", "right-bottom".

  • Don't display the message ("false").

no

"top-left"

preview

Displaying an image preview after image file upload:

  • preview=true — Display an image preview.

  • preview=false — Don't display an image preview.

no

true

camera

Open the camera when the image upload button is clicked:

  • camera=true — Open camera.

  • camera=false — Don't open camera.

no

false

compress

Image compression:
  • compress=true — Reduce image size to 1000*1000 pixels (the image is saved in JPEG format with quality level 90).

  • compress=false — Leave image without changes.

no

true

requiredCoordinates

Whether coordinates should be required in the image data.
  • requiredCoordinates=true — Coordinates should be required.

  • requiredCoordinates=false — Coordinates should not be required.

no

false

Add a field of file type into the output data description. For example:

{
  "result": {
    "type": "file",
    "required": true
  }
}