Community Tip - If community subscription notifications are filling up your inbox you can set up a daily digest and get all your notifications in a single email. X
Hi,
Could you give the example for how to load the image dynamically.
Example: user has to load the image from local system at run time(C: drive ).
Thank you.
Solved! Go to Solution.
Hi,
The widget fileupload allows the user to select a file from the file system and upload it in a ThingWorx FileRepository.
From the file repository, the image can be saved as a media entity.
// load the image from ThingWorx file repository
var paramsLoadImage = {
path: imagePath /* STRING */
};
var imageContent = Things[repositoryName].LoadImage(paramsLoadImage);
// create a media entity
var paramsCreateMediaEntity = {
name: imageName /* STRING */,
content: imageContent /* IMAGE */
};
Resources["EntityServices"].CreateMediaEntity(paramsCreateMediaEntity);
// output the source URL of the media entity which can be used as input for the image widget
var result = "/Thingworx/MediaEntities/" + imageName
Hi,
The widget fileupload allows the user to select a file from the file system and upload it in a ThingWorx FileRepository.
From the file repository, the image can be saved as a media entity.
// load the image from ThingWorx file repository
var paramsLoadImage = {
path: imagePath /* STRING */
};
var imageContent = Things[repositoryName].LoadImage(paramsLoadImage);
// create a media entity
var paramsCreateMediaEntity = {
name: imageName /* STRING */,
content: imageContent /* IMAGE */
};
Resources["EntityServices"].CreateMediaEntity(paramsCreateMediaEntity);
// output the source URL of the media entity which can be used as input for the image widget
var result = "/Thingworx/MediaEntities/" + imageName
Thank You for solution. Its working for me