The better, more dynamic option is to use Webdev. Install the module, then in the designer set up a new Python endpoint with a name like images
- this will ultimately “mount” the endpoint at <gateway address>/system/webdev/<projectname>/images
.
In the doGet
scripting event, run the (named) query you want to to fetch a particular image. You can get the path, ie something.png
in a request to images/something.png
via request['remainingPath']
- use that as a parameter in your (named) query to fetch the bytes for the appropriate image.
Then, return those bytes using the bytes
return type:
return {"bytes": myQueryOutputVar}
And you should be able to use an appropriate URL directly in Perspective’s image component, or anywhere else you can use a direct image path.