Skip to content

Commit 235943e

Browse files
committed
online image preview, screenshots update
1 parent be928aa commit 235943e

27 files changed

+53
-11
lines changed

src/layer/embed-image/index.md

Lines changed: 39 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,47 @@
11
---
2-
description: HTML widget can be used to embed an online image in the attributes form of your survey layer.
2+
description: Preview online images in the attributes form of your survey layer using the Attachment or HTML widgets.
33
---
44

55
# How to Embed an Image
6+
Online images can be displayed in the attributes form of a survey layer. There are two options:
7+
- [Using the Attachment widget](#using-the-attachment-widget) is a straight-forward option to preview an online image in the form. Tapping the image in the form in the <MobileAppNameShort /> opens the image, so you can explore it in more detail directly in the app.
8+
- [The HTML widget](#using-the-html-widget) uses a link stored in a field to display the image. Tapping the image in the form in the <MobileAppNameShort /> opens the image in a web browser (outside of the app).
69

7-
The [**HTML widget**](../info-widgets/#html-widget) can be used to display online images in the <MobileAppNameShort />.
10+
![Mergin Maps mobile app online image preview](./mobile-embed-image.webp "Mergin Maps mobile app online image preview")
811

912
::: tip Example project available
10-
Clone <MerginMapsProject id="documentation/forms-display-images-and-files" /> to how this works.
13+
Both options are included in our example project <MerginMapsProject id="documentation/forms-display-images-and-files" />. Clone it to see how they work.
14+
:::
15+
16+
## Using the attachment widget
17+
The attachment widget can be configured to display online images in the form of a survey layer.
18+
19+
The survey layer needs to have a text field for storing the full URL link (here: `photo`).
20+
21+
1. Right-click on the survey layer, select **Properties** and go to the **Attributes form** tab.
22+
2. In the list of **Available Widgets** select the text field you want to work with (here: `photo`).
23+
3. In the **Widget Type** tab:
24+
- From the drop-down menu, select the **Attachment** widget
25+
- Store the path as **Absolute path**
26+
- Set the **Integrated Document Viewer** to use the type **Web View**
27+
28+
![QGIS Attachment widget setup for online images preview](./qgis-form-attachment-widget.webp "QGIS Attachment widget setup for online images preview")
29+
30+
4. **Apply** the changes
31+
32+
Online images can now be displayed in the form, both in QGIS (left) and in <MobileAppName /> (right):
33+
![Online image preview in QGIS and in Mergin Maps mobile app](./qgis-mobile-form-online-image-attachment.webp "Online image preview in QGIS and in Mergin Maps mobile app")
34+
35+
When you click or tap on the image, it will open directly in the form and you can zoom in.
36+
37+
::: details Image preview in QGIS
38+
Some QGIS versions may not display the preview of the image correctly. This issue does not occur in <MobileAppNameShort />. Therefore we recommend trying the setup by opening the form in the <MobileAppNameShort /> to make sure it works as intended.
1139
:::
1240

41+
## Using the HTML widget <Badge text="Advanced" type="warning"/>
42+
43+
The [**HTML widget**](../info-widgets/#html-widget) can be used to display online images in the <MobileAppNameShort />.
44+
1345
Your layer should contain a text field for storing the full URL link (here: `link`).
1446

1547
To show an online image in the form, [add the HTML widget to the form](../info-widgets/) and configure it with this expression (replace `link` with the name of the appropriate field in your layer):
@@ -18,9 +50,11 @@ To show an online image in the form, [add the HTML widget to the form](../info-w
1850
<script>document.write(expression.evaluate("'<a href=\"'||attribute( @feature, 'link' )||'\"><img src=\"'||attribute( @feature, 'link' )||'\" width=300></a>'"));</script>
1951
```
2052

21-
Make sure that the HTML widget works before taking it to the field by testing it in the <MobileAppNameShort />. It should look something like this:
53+
Make sure that the HTML widget works before taking it to the field by testing it in the <MobileAppNameShort />. It should display the online image both in QGIS (left) and in the <MobileAppNameShort /> (right):
54+
55+
![HTML widget in QGIS and in Mergin Maps mobile app](./qgis-mobile-form-online-image-html.webp "HTML widget in QGIS and in Mergin Maps mobile app")
2256

23-
![HTML widget in QGIS and in Mergin Maps mobile app](./qgis-mobile-html-form.webp "HTML widget in QGIS and in Mergin Maps mobile app")
57+
When you click or tap on the image, it will open in a web browser.
2458

2559
::: details Image preview in QGIS
2660
Some QGIS versions may not display the preview of the image correctly. This issue does not occur in <MobileAppNameShort />. Therefore we recommend trying the setup by opening the form in the <MobileAppNameShort /> to make sure it works as intended.
170 KB
Loading
829 KB
Binary file not shown.
52.2 KB
Loading
468 KB
Binary file not shown.
125 KB
Loading
Binary file not shown.
86.3 KB
Loading
317 KB
Binary file not shown.

src/layer/form-layout/index.md

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,11 +27,15 @@ QGIS Drag and Drop designer is an easy tool for defining the form layouts:
2727
<Badge text="since QGIS 3.30" type="tip"/>
2828
The Spacer widget can be useful if you want to have some space between the fields in your form or add a horizontal line.
2929

30+
::: tip Example project available
31+
The spacer widget is used in <MerginMapsProject id="documentation/forms-display-images-and-files" />.
32+
:::
33+
3034
It can be found in *Available Widgets* in the *Other Widgets* section when using the [Drag and Drop Designer](#qgis-drag-and-drop-designer).
3135
![QGIS forms Spacer Widget](./qgis-form-spacer-widget.jpg "QGIS Spacer Widget")
3236

3337
When adding the spacer widget to the form, there is an option to check the **Draw horizontal line** option. Otherwise, a vertical space will be added to the form.
3438
![QGIS Spacer Widget configuration](./qgis-configure-spacer-widget.jpg "QGIS Spacer Widget configuration")
3539

3640
And this is how the spacer widget looks like in the form in QGIS (left) and in the mobile app (right).
37-
![Spacer widget in QGIS and mobile app form](./spacer-widget-forms.jpg "Spacer widget in QGIS and mobile app form")
41+
![Spacer widget in QGIS and mobile app form](./spacer-widget-forms.webp "Spacer widget in QGIS and mobile app form")

0 commit comments

Comments
 (0)