Displaying GIF/JPEGS In Webportal Pages

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

1 Like

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:

  1. IMAGE READER to get the PNG file into a table
  2. RENDER TO IMAGE
  3. TABLE TO IMAGE to get it in the format needed
  4. 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? stick_figure_run_clock_400_clr_7435

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.

Hi @ScottMcLeodPSLGroup,
what if you use a Table Creator with one cell that contains the image URI, then a Read Images node, followed by Table To Image and Image Output Widget? For me this displays the image correctly.
Kind regards,
Alexander

1 Like

Great solution! Thank you. Exactly what I needed.

2 Likes

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.