Community Tip - Learn all about the Community Ranking System, a fun gamification element of the PTC Community. X
Hi,
This the code that I'm using to convert base64 code input into an image output, I have gathered this code from the community itself but it is not working for me... Showing No Image Available error.
var input;
var binaryString = "";
for (var i = 2; i < input.length; i += 2) {
binaryString += String.fromCharCode(
parseInt(
input.substr(i, 2),
16
)
);
}
var result = base64EncodeString(binaryString);
Solved! Go to Solution.
Hi @sagar.d, I noticed that your input is already a base64 string and not a binary string.
So you just need to cut the header part (i.e., data:image/png;base64,) and keep the rest:
var result = input.split(',')[1];
Hope it helps.
Hi @sagar.d, I noticed that your input is already a base64 string and not a binary string.
So you just need to cut the header part (i.e., data:image/png;base64,) and keep the rest:
var result = input.split(',')[1];
Hope it helps.
Hi @CharlesJi thanks for the response, really appreciate it.
I have tried removing the header part as you said, and entered the rest in input, still not getting any image.
The input data-type I am using is BLOB, if I use String - the output is a broken image.
Thanks a lot!