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

Community Tip - Need to share some code when posting a question or reply? Make sure to use the "Insert code sample" menu option. Learn more! X

Read Image from repository and convert it to Base64 code

RK_0705
12-Amethyst

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.

ACCEPTED SOLUTION
7 REPLIES 7
VladimirN
24-Ruby II
(To:RK_0705)
TonyZhang
15-Moonstone
(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 */
});
 

Tony
TonyZhang
15-Moonstone
(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

Tony
RK_0705
12-Amethyst
(To:TonyZhang)

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

RK_0705
12-Amethyst
(To:VladimirN)

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

VladimirN
24-Ruby II
(To:RK_0705)

You're welcome.

Announcements


Top Tags