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

Community Tip - Did you get an answer that solved your problem? Please mark it as an Accepted Solution so others with the same problem can find the answer easily. X

Show image from TWX

5-Regular Member

Show image from TWX


I want to show photo from Image Repository in TWX, but photo stored there is saved as base64. I was trying to get that photo via 'loadImage' service, then convert from base64 to jpg with '`data:image/jpg;base64,${response.rows[0].Content}`' and set this as src in 3dImage. 

And it works in preview mode, but on mobile it doesn't. 

I get an error : 

'ERROR, data: ["Could not add 3D image: image_0_3"]; discarding callback; args=["image_0_3","image_0_3","data:image/jpg;base64,/9j/4AAQSkZJ...'

So how can I get image from TWX and set it as 3dImage?


Hi @JT_10028013,


You can store image in ThingWorx server @<Tomcat>\webapps\Thingworx\images folder

Then the images can be accessed using URL such as http://<server>:<port>/Thingworx/images/111.jpg


You can add above image link as an Application Parameter in Studio.

Bind the image URL (parameter) to the Resource of the 3D image.


Make sure the ThingWorx(image) URL is accessible from the View device.


Refer to



Have you tried the url from the repo for example


$scope.view.wdg['myimage'].imgsrc=repoURL // from example "/Thingworx/FileRepositories/TakePhoto_Repo/photos/demo/1645196272644.png"


Then you don't have to deal with the content. 


This is an example of an upload service in Thingworx


logger.debug("Entering UploadPhoto" );

if (fileName === undefined || fileName === "") {
var d = new Date();
fileName = "Photo-" + d.getTime();

// result: STRING
var usename = Resources["CurrentSessionInfo"].GetCurrentUser();

//Create Folder in doesn't exist
try {
path: '/photos/'+ usename /* STRING */

} catch (ex) {
// decide how to inform user


path: '/photos/'+ usename + '/'+fileName /* STRING */,
content: imageContent /* IMAGE */


Top Tags