I’m unable to figure out how to display an image stored in the Servoy Media of a solution within a report generated by Velocity; what actually goes into the HTML template? There is reference to using plugins.getMedia() (which doesn’t seem to exist, although solutionMode.getMedia() does) but not what the syntax is within the template itself to display the image.
The FAQ references getImageTag() but I also cannot figure out what the ```
<img src=“theinternalURLOfYourBlobObject”
Anything would be much appreciated as I'm sure it must be quite simple.
Thanks in advance.
You can embed the whole image in the template like so:
var template = '<html><head></head><body><p>$myLogo</p></body></html>';
// no img tag needed, it will be generated for you
var context = {myLogo: plugins.VelocityReport.getByteMedia(foundset.logo)};
// parameter options are getByteMedia(bytes, [id], [width], [height], [cssClass]):
application.output(plugins.VelocityReport.evaluateWithContext(template, context));
Reading your post again I see you actually wanted to use an image that is part of the solution. You can use the same code with a slight change:
Use solutionModel.getMedia(‘myLogo.png’).bytes instead of foundset.logo.
So the code would look like this:
var template = '<html><head></head><body><p>$myLogo</p></body></html>';
// no img tag needed, it will be generated for you
var context = {myLogo: plugins.VelocityReport.getByteMedia(solutionModel.getMedia('myLogo.png').bytes)};
// parameter options are getByteMedia(bytes, [id], [width], [height], [cssClass]):
application.output(plugins.VelocityReport.evaluateWithContext(template, context));