2
0
mirror of https://github.com/inventree/InvenTree.git synced 2025-06-12 10:05:39 +00:00

Report files (#4946)

* Adds more report tags

- uploaded_file: Load qualified path for a media file
- encode_svg_image: Encode an svg image as base64 data

* Docs updates
This commit is contained in:
Oliver
2023-06-02 07:54:15 +10:00
committed by GitHub
parent 11c5ce5f80
commit 60f2f1ea86
2 changed files with 46 additions and 2 deletions

View File

@ -148,6 +148,19 @@ You can access an uploaded image file if you know the *path* of the image, relat
!!! warning "Invalid Image"
If the supplied file is not a valid image, it will be replaced with a placeholder image file
### SVG Images
SVG images need to be handled in a slightly different manner. When embedding an uploaded SVG image, use the `{% raw %}{% encode_svg_image ... %}{% endraw %}` tag:
```html
{% raw %}
<!-- Load the report helper functions -->
{% load report %}
<img src='{% encode_svg_image svg_image_file %}'/>
{% endraw %}
```
### Part images
A shortcut function is provided for rendering an image associated with a Part instance. You can render the image of the part using the `{% raw %}{% part_image ... %}{% endraw %}` template tag: