Incubator-superset: Ability to display images/pdfs in the dashboard

Created on 7 Nov 2019  路  6Comments  路  Source: apache/incubator-superset

One of the use-case of the superset dashboards for me is to display images by downloading them from the s3 bucket. The database entry has the s3 location and I would like to download the image and display it.

It will be great if someone can give me directions on how can I implement this.

request inactive

Most helpful comment

@akashr050 I found a way to do this!

The table chart type displays html. For a demo go to sql lab, enter the following, and then click Explore:

    '<a href="https://github.com/apache/incubator-superset">superset link</a>' as link,
    '<img src="https://media.giphy.com/media/lcySndwSDLxC4eOU86/giphy.gif" alt="panda" />' as img

If you have a column of s3 urls, you could do

  CONCAT('<img src="', s3_img_url, '" alt="s3 image" />') AS s3_img_html
FROM my_table

All 6 comments

Issue-Label Bot is automatically applying the label #enhancement to this issue, with a confidence of 0.97. Please mark this comment with :thumbsup: or :thumbsdown: to give our bot feedback!

Links: app homepage, dashboard and code for this bot.

If you know your urls in advance, you can add Markdown to a dashboard. But it sounds like you're looking for a way to display an image from your data, and I don't think there's a way to do that right now.

It would be cool to add this. I can think of two implementations that might make sense:

  • add jinja templating to the markdown chart-type
  • add an option in the table chart-type to treat a column as an image link

Maybe both!

@suddjian Thanks for your comments. I think we can start with the jinja templating options and contribute that feature first. But I am not familiar with the codebase so I would really appreciate if you can guide me wrt this. Even which part of the code / files I should start looking at to add this feature will be helpful.

I'm pretty new to the Superset codebase too. 馃檶 The markdown gets parsed at https://github.com/apache/incubator-superset/blob/0.34.0/superset/viz.py#L735, so if we want to add some jinja that might be the easiest place.

The charts themselves live in https://github.com/apache-superset/superset-ui-plugins, but it wasn't always that way, and it looks like the markup chart might have only been partially ported over there. The code powering it seems to mostly live in the superset repo.

@akashr050 I found a way to do this!

The table chart type displays html. For a demo go to sql lab, enter the following, and then click Explore:

    '<a href="https://github.com/apache/incubator-superset">superset link</a>' as link,
    '<img src="https://media.giphy.com/media/lcySndwSDLxC4eOU86/giphy.gif" alt="panda" />' as img

If you have a column of s3 urls, you could do

  CONCAT('<img src="', s3_img_url, '" alt="s3 image" />') AS s3_img_html
FROM my_table

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. For admin, please label this issue .pinned to prevent stale bot from closing the issue.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

vylc picture vylc  路  3Comments

ghost picture ghost  路  3Comments

XiaodiKong picture XiaodiKong  路  3Comments

kalimuthu123 picture kalimuthu123  路  3Comments

eliab picture eliab  路  3Comments