get Image in widget from a table
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-27-2017 08:45 AM
hi ,
i need to show images in my widget , those images are in a table i kan jyst get the display value by using image.getDisplayValue() but i what i need really is the whole image to put it in my widget ,
any ideas pls ??
thanks

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-27-2017 08:59 AM
1) Put the image display name onto the data object in Server Script
2) Use the data object in your HTML to set the src attribute of an img tag
var imageId = '9970957e5f130100a9ad2572f2b4776f';
var gr = new GlideRecord("db_image");
gr.get(imageId);
data.image1=gr.getDisplayValue()
<div>
<img src="{{c.data.image1}}">
</div>
I hope this helps!

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-28-2017 05:52 AM
Sorry, I have just noticed my HTML didn't come through
<div>
<img src="{{c.data.image1}}">
</div>