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

Community Tip - Have a PTC product question you need answered fast? Chances are someone has asked it before. Learn about the community search. 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
12-Amethyst
(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
12-Amethyst
(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