mirror of
https://github.com/inventree/InvenTree
synced 2024-08-30 18:33:04 +00:00
parent
38ad83e401
commit
fc0a860e9b
@ -8,7 +8,7 @@ A stock location represents a physical real-world location where *Stock Items* a
|
||||
|
||||
## Stock Location Type
|
||||
|
||||
A stock location type represents a specific type of location (e.g. one specifc size of drawer, shelf, ... or box) which can be assigned to multiple stock locations. In the first place, it is used to specify an icon and having the icon in sync for all locations that use this location type, but it also serves as a data field to quickly see what type of location this is. It is planned to add e.g. drawer dimension information to the location type to add a "find a matching, empty stock location" tool.
|
||||
A stock location type represents a specific type of location (e.g. one specific size of drawer, shelf, ... or box) which can be assigned to multiple stock locations. In the first place, it is used to specify an icon and having the icon in sync for all locations that use this location type, but it also serves as a data field to quickly see what type of location this is. It is planned to add e.g. drawer dimension information to the location type to add a "find a matching, empty stock location" tool.
|
||||
|
||||
## Stock Item
|
||||
|
||||
|
@ -78,21 +78,21 @@ def report_page_size_default():
|
||||
return page_size
|
||||
|
||||
|
||||
def encode_image_base64(image, format: str = 'PNG'):
|
||||
def encode_image_base64(image, img_format: str = 'PNG'):
|
||||
"""Return a base-64 encoded image which can be rendered in an <img> tag.
|
||||
|
||||
Arguments:
|
||||
image: {Image} -- Image to encode
|
||||
format: {str} -- Image format (default = 'PNG')
|
||||
img_format: {str} -- Image format (default = 'PNG')
|
||||
|
||||
Returns:
|
||||
str -- Base64 encoded image data e.g. 'data:image/png;base64,xxxxxxxxx'
|
||||
"""
|
||||
fmt = format.lower()
|
||||
img_format = str(img_format).lower()
|
||||
|
||||
buffered = io.BytesIO()
|
||||
image.save(buffered, fmt)
|
||||
image.save(buffered, img_format)
|
||||
|
||||
img_str = base64.b64encode(buffered.getvalue())
|
||||
|
||||
return f'data:image/{fmt};charset=utf-8;base64,' + img_str.decode()
|
||||
return f'data:image/{img_format};charset=utf-8;base64,' + img_str.decode()
|
||||
|
Loading…
Reference in New Issue
Block a user