I want to display some images on webportal pages in my workflow. I’ve been able to successfully use the “Text Output” node with static HTML to display the picture. For example in that node I will have only something like this:
IMG SRC=“D:/AdhocDataFiles/psllogo.png” (I removed the leading and trailing carrots because the form interprets those as HTML commands and does not display when you view this message but in the node I do place those there).
When editing the workflow in the Analytics workbench, if I select “Interactive View” on the component, it displays the picture properly in the screen. However when I run it from the weportal, the picture fails to load. All the rest of the pages elements look fine. What could be causing this?
Hi,
That’s because of the content security policy of KNIME Server (https://developer.mozilla.org/en-US/docs/Web/HTTP/CSP). It prevents external data from being loaded for security reasons. For example to avoid cross site scripting. You can show images with the Image Output Widget instead.
Kind regards
Alexander
Thank you. Disappointing but I can work with that. However its not what I expected. I have a PNG file. What I figured out through trial and error was to use 4 nodes:
IMAGE READER to get the PNG file into a table
RENDER TO IMAGE
TABLE TO IMAGE to get it in the format needed
IMAGE OUTPUT WIDGET to display on the web portal.
The problem is the reader does a terrible job on the input. It messes the colors up and basically makes it black and white. The sample PNG I’ve attached shows what I’m trying to display on the portal window.
I don’t see any way to control color corrections and things like that. is there a better way to get the data from a local file into the format required for the image output widget?
Update. It seems the image reader is not able to process an image with a clear background. If I make the image a solid color it processes fine. Ideally I’d like to keep a clear background so the image blends seamlessly into the users selected background color preferences.