Hello everyone,
How would I dynamically path to an image in the image management tool to be displayed on a report?
The documentation seems to suggest that you can either drag images from the image manager (this isn't dynamic) or use a byte array data source as the data key.
I started with the naive approach of having the image path as a parameter, then setting that parameter as the data key of the image component. This didn't work.
The next attempt was to create a scripted data source,
from com.inductiveautomation.ignition.gateway import IgnitionGateway
from com.inductiveautomation.ignition.gateway.images import ImageRecord
context = IgnitionGateway.get()
imageManager = context.getImageManager()
# data['image_path'] = "//system//images//image.png"
imageData = imageManager.getImage(data['image_path'])
imageBytes = imageData.getBytes(ImageRecord.Data)
data['imageBytes'] = imageBytes
However, this results in a
AttributeError: 'NoneType' object has no attribute 'getBytes'
error.
I'm assuming the scripting is close, as the error occurs after the imageManager is instantiated, and the file path formatting is probably incorrect.
Is this something that can be done?