Skip to main content
1-Visitor
October 29, 2021
Solved

Read Image from repository and convert it to Base64 code

  • October 29, 2021
  • 3 replies
  • 2888 views

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.

3 replies

24-Ruby III
October 29, 2021
16-Pearl
November 4, 2021

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 */
});
 

16-Pearl
November 18, 2021

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

RK_07051-VisitorAuthor
1-Visitor
December 20, 2021

@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.

VladimirN24-Ruby IIIAnswer
24-Ruby III
December 20, 2021