From 185e2b9c290d905bfd55beb7d4d07f5277a0eebb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mikl=C3=B3s=20M=C3=A1rton?= Date: Fri, 22 Jul 2022 00:03:06 +0200 Subject: [PATCH] Extend documentation about loading media files (#317) Fixes #312 --- docs/report/labels.md | 4 ++++ docs/report/media.md | 41 +++++++++++++++++++++++++++++++++++++++++ 2 files changed, 45 insertions(+) create mode 100644 docs/report/media.md diff --git a/docs/report/labels.md b/docs/report/labels.md index c140257..4462982 100644 --- a/docs/report/labels.md +++ b/docs/report/labels.md @@ -104,6 +104,10 @@ Refer to the [context variables documentation](./context_variables.md). Refer to the [barcode documentation](./barcodes.md). +### Using media files + +Refer to the [media files documentation](./media.md). + ### Conditional Formatting Conditional formatting of label data is also supported. Below is an example excerpt from a label which determines the content based on the supplied context variables: diff --git a/docs/report/media.md b/docs/report/media.md new file mode 100644 index 0000000..13633de --- /dev/null +++ b/docs/report/media.md @@ -0,0 +1,41 @@ +--- +title: Using media files +--- + +## Images + +To load images into the reports/labels the report helper must be loaded in the template. + +```html +{% raw %} + +{% load report %} +{% endraw %} +``` + +### Assets + +You can add images to the reports and labels by using the asset template tag: + +```html +{% raw %} + +{% load report %} + +{% endraw %} +``` + +!!! info "Assets location" + You need to place your asset images to the report/assets directory in the [data directory](../start/docker_dev.md/#data-directory) + +### Part images + +You can render the images of the parts using the part_image template tag: + +```html +{% raw %} + +{% load report %} + +{% endraw %} +```