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

Community Tip - Need help navigating or using the PTC Community? Contact the community team. X

How to set the uploaded image in Thing property?

done11
1-Newbie

How to set the uploaded image in Thing property?

Hi,

I am using File Upload Widget to select an image and upload it.

The selected image is stored at repository.

I wanted to save the image to thing property which as the base type as "IMAGE LINK".

is there any way?

Thanks in advance!

2 REPLIES 2
supandey
19-Tanzanite
(To:done11)

Hi you could try with the File Repository's service called GetFileInfo in fact there are bunch of other services for getting the directory structure together with files and their download links. I believe you can either use one of those or just modify the one you feel appropriate to get the full path of a specific image stored in repository which can then be pushed to IMAGE LINK.

You might want to explore the generic services in FileRepositoryThing (ThingWorx Platform API 7.1.0)

jamesm1
5-Regular Member
(To:supandey)

I think the IMAGELINK base type will only work for media entities. You will need to use the IMAGE base type, and get the raw base64 data from the image in the file repository to set as the image value.

Edit: You can do this by getting the image link from the repo as Sushant recommended (there is a standard url path: something like /Thingworx/FileRepositoy/FileRepoName/Path/Image.png, I think) and then using the LoadImage function:

var params = {

    url: "IMAGEURL IN FILE REPO"

};

// result: STRING

me.PROPERTYNAME = Resources["ContentLoaderFunctions"].LoadImage(params);

Top Tags