get Image in widget from a table

soukayna
Tera Contributor

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

2 REPLIES 2

sndangibbard
Mega Guru

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!


sndangibbard
Mega Guru

Sorry, I have just noticed my HTML didn't come through



<div>


  <img src="{{c.data.image1}}">


</div>