Skip to main content
1-Visitor
September 5, 2018
Question

Dynamically change Images

  • September 5, 2018
  • 1 reply
  • 2010 views

Hello everyone,

 

I am using Images and 3D Images in my experience. Now I would like to change the images during runtime. The current image that should be displayed is a property of one of my things.

 

How can I display the current image of the thing in the Image views of the experience? When selecting the ''currentImage'' property of my thing which has the type IMAGE, the binary of the image is returned (apparently).

 

Any help is appreciated very much!

 

Best Regards,

Dominik

This topic has been closed for replies.

1 reply

1-Visitor
September 5, 2018

you can change the image of your widget at runtime and pass it an image from your resources:

something like below should work

var currentId; 
$scope.app.view.Home.wdg["myWidget"].src="app/resources/Uploaded/MyImageSequence_" + currentId + ".png";

 MyImageSequence_" + currentId + ".png";  Is just any image you uploaded, iterated through by an index, changing the filename accordingly (just nameyour images like Image_1.jpg Image_2.jpg ...)

I also noticed that loading images at runtime like that take a long time.

drieder1-VisitorAuthor
1-Visitor
September 11, 2018

Thank you for your reply.

 

Unfortunately I don't have the images stored on my machine locally. I have a thing from Thingworx bound to my experience which has an image property. Since this image changes frequently (its a camera), I would like to show the current image in the 3D image widget.