mirror of
				https://github.com/inventree/inventree-docs.git
				synced 2025-10-31 12:55:37 +00:00 
			
		
		
		
	| @@ -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: | ||||
|   | ||||
							
								
								
									
										41
									
								
								docs/report/media.md
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										41
									
								
								docs/report/media.md
									
									
									
									
									
										Normal file
									
								
							| @@ -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 the report helper functions --> | ||||
| {% load report %} | ||||
| {% endraw %} | ||||
| ``` | ||||
|  | ||||
| ### Assets | ||||
|  | ||||
| You can add images to the reports and labels by using the asset template tag: | ||||
|  | ||||
| ```html | ||||
| {% raw %} | ||||
| <!-- Load the report helper functions --> | ||||
| {% load report %} | ||||
| <img src="{% asset 'my_awesome_logo.png' %}"/> | ||||
| {% 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 the report helper functions --> | ||||
| {% load report %} | ||||
| <img src='{% part_image part %}'/> | ||||
| {% endraw %} | ||||
| ``` | ||||
		Reference in New Issue
	
	Block a user