Skip to content

Use attachment

In QField, a field with Attachment widget can be used to:

  • show and take photos
  • show and record videos
  • listen and record sound clips
  • show links to external files like PDFs or documents

Attachments
Attachments

To configure the Widget, please refer to the Attributes Form Documentation

Add a series of pictures to a feature

Desktop preparation

One or more pictures can be added to the feature. Here is an example of how to proceed.

Tables

It is necessary to set up two tables. One table where the features are stored and one with a list of pictures.

Apiary

Field Type
id Text (UUID)
geometry Geometry
...

Apiary_pictures

Field Type
id Text (UUID)
apiary_id Text (UUID)
path Text
...

Relations

Create a relation with:

  • apiary Referenced layer
  • id Referenced field
  • apiary_picture Referencing layer
  • apiary_id Referencing field
  • strength Composition

Relations
Relations

Widgets

Apiary

Set the default value of the field id to uuid() or use the UUID Generator widget. No need to show it in the form.

widgets
widgets

Set the relation widget to many to one relation and add the relation to the form

widgets
widgets

Apiary picture

Set the widget type of the field path to Attachment and add it to the form

widgets
widgets

Geotagging

Fieldwork

Some mobile devices will require for native camera mode to be turned off to enable geotagging.

To enable geotagging in case your native OS camera does not support this functionality, follow these steps:

  1. In QField, go to the settings and make sure Use native Camera is deactivated on your mobile device
  2. Completed! QField's own QML-based camera will now be utilized while taking pictures

Maximum picture size

Desktop preparation

The advanced settings allow rescaling the photos to a maximum width/height in QFieldSync plugin > Project configuration

image

Configurable attachment path

Desktop preparation

QFieldSync provides the possibility to configure the path of picture attachments.

  1. Go to QFieldSync plugin > Layers Properties
  2. Choose the layer, the field and configure the expression

Use expressions to specify the path of the attachments. By default, pictures are saved into the "DCIM" folder, audio are saved into the "audio" folder and videos are saved into "video" with a timestamp as name.

picture path
picture path

Additional directories can be synchronized with pictures or other attachments. Extra paths can be configured in Attachment directories. All paths are relative to the project directory.

attachments directories
attachments directories

Note

QGIS 3.14 or newer is required for this functionality