cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Showing results for 
Search instead for 
Did you mean: 

Community Tip - Learn all about the Community Ranking System, a fun gamification element of the PTC Community. X

display image dynamically

spandey1
1-Newbie

display image dynamically

Hi,

i want to display images in image widget dynamically.

i have tried file repository to display image in image widget that works fine, but i want to make it dynamic.

lets say i have 100 devices and each has different images, so on the same mashup i am displaying different device data based on the device selected  through service.

so displaying data is fine but how can i display different images in mashup

Thanks

1 REPLY 1

There's a few ways you can do this,and of course it depends on where/how you want to store the images. An important key here is that there are two ways to display images, using an Image URL (passed into the Image widget), or using an actual Image basetype (passed into a Value Display widget).

Probably the simplest way would be to add a property to your device Things of baseType image. Then you can simply grab it and display it using the Value Display widget. The image widget does not accept this type of data, it takes an ImageURL, so you must use the Value Display widget

Alternatively, if you are set on holding the images in a file respository, you can write your own service that dynamically builds the path input for the repo's 'LoadImage' service based on some input, probably your selected device's thingName. I forget if this returns an Image or an ImageURL, but either way you can display it, you just need to use the appropriate widget.

You can also make a bunch of media entities and store the images in there, then build a service to grab the image from them or have a service build the REST url location for them.

Surely there are more ways depending on what your use case is, but you can experiment with these and see if it helps.

Good luck!

Top Tags