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
Hi Developers,
I'm trying to create the following functions.
1. save image file to SQL as binary data.
2. pull binary data from SQL.
3. create Image contents from the binary data to display on mashup.
I'm struggling to create codes for part 3.
Could anyone help me for the part3?
Solved! Go to Solution.
Hi @Yoshihiko.N
You are trying to convert base64/binary data again to base64 string
Output from LoadBinary can be directly viewed as an Image
let result = Things["SystemRepository"].LoadBinary({
path: "/images.png" /* STRING */
});
In your use case :
// Image binary string
let data = Things["SystemRepository"].LoadBinary({
path: "/images.png" /* STRING */
});
// Write service to store data in DB
// Query data from DB
// For example : input dbString will be data from the DB
var result = dbString;
/VR
Hi @Yoshihiko.N
Set the result output type to Image
More Information -
Solved: Convert base64 code to image - PTC Community
/VR
Hi
Thank you for your quick response.
I tried but failed.
Hi @Yoshihiko.N
You are trying to convert base64/binary data again to base64 string
Output from LoadBinary can be directly viewed as an Image
let result = Things["SystemRepository"].LoadBinary({
path: "/images.png" /* STRING */
});
In your use case :
// Image binary string
let data = Things["SystemRepository"].LoadBinary({
path: "/images.png" /* STRING */
});
// Write service to store data in DB
// Query data from DB
// For example : input dbString will be data from the DB
var result = dbString;
/VR