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

Read Image from repository and convert it to Base64 code

RK_0705
11-Garnet

Read Image from repository and convert it to Base64 code

Hi,

 

Which service in ThingWorx 9.2 is used to convert image into base64 code.

 

Please share the snippet of reading the image from repository and converting it into base64 code.

 

Thanks in advance.

1 ACCEPTED SOLUTION
7 REPLIES 7
VladimirN
24-Ruby II
(To:RK_0705)
TonyZhang
13-Aquamarine
(To:RK_0705)

Hi @RK_0705,

 

Maybe you can try using LoadBinary function of FileRepository things to load Blob content of the image in your repository.

 

let Content = Things["RepositoryName"].LoadBinary({
    path: "/pathToImage/image.jpg" /* STRING */
});
 

TonyZhang
13-Aquamarine
(To:RK_0705)

Hi @RK_0705,

 

If you feel your question has been answered, please mark the appropriate response as the Accepted Solution for the benefit of others with the same question.

 

Regards,
Tony

@TonyZhang @VladimirN 

LoadBinary service is returning the Base64 code but in BLOB type.

Could you please help me how to parse from BLOB to STRING in ThingWorx 9.2 as I have to pass base64 code to one rest api which is expecting STRING as input and not as type BLOB.

 

Thanks in advance.

@VladimirN Thank you for your speedy and amazing help. It worked

VladimirN
24-Ruby II
(To:RK_0705)

You're welcome.

Top Tags