Need to do an API call where they require a base64 string instead of an image URL, is there anyway to do this with images uploaded to glide?
You’d need to use a JavaScript column to download the image, encode it, and then return the encoded string.
2 Likes
Something like this?
function convertImageToBase64(url) {
return fetch(url)
.then(response => response.blob())
.then(blob => {
return new Promise((resolve, reject) => {
const reader = new FileReader();
reader.onloadend = () => resolve(reader.result);
reader.onerror = reject;
reader.readAsDataURL(blob);
});
});
}
return convertImageToBase64(p1);
4 Likes
This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.