Convert image Url from Glide to Base 64 with inetgromat

Hi everyone,

I am writing to you because I am trying to convert the profile photos of my users glide to Base64 with Make but I don’t know how to do it and I don’t know about Javascript. The goal is that it automatically converts which is why I use Make. Photos are URLs. Maybe one of you can help me?
Thank you in advance.

Are you aware that you can do that in Glide with the Encode Text column?

Thank’s a lot, I didn’t know that I can do that with Encode text column .

Sorry I tried and it didn’t work. What should I put in the part "Encode (base64,url)? Because when I do: text = my column image
Encode = base64
the code the column returns to me does not work.

That encodes the url, not the image itself, right? I’m not sure if you can encode an image inside of Glide. That would probably require javascript with an external library, or an external service.

I don’t have thoughts off the top of my head. I’ve done it manually with an external service, but not on a large scale.

1 Like

First, I have to disclose that I don’t code, I found this bit after some heavy online searching. It’s for Zapier, but it might be enough for you to do something similar in Make. - https://community.zapier.com/code-webhooks-52/converting-an-image-to-base64-3529

1 Like

I did some research and this should work in a javascript column.

const getBase64FromUrl = async (url) => {
  const data = await fetch(url);
  const blob = await data.blob();
  return new Promise((resolve) => {
    const reader = new FileReader();
    reader.readAsDataURL(blob); 
    reader.onloadend = () => {
      const base64data = reader.result;   
      resolve(base64data);
    }
  });
}

return getBase64FromUrl(p1);

Just need to pass the image url in the p1 parameter.

3 Likes

oh yeah, good point. hahaha :man_facepalming:

1 Like

Thanks for your answer, In fact I would like to encode the profile image from my Glide database so I don’t have the Url directly. Can I still use this code?

Yes.

Put the code that Jeff gave you in a JavaScript column, and use your profile image column as a replacement for p1.

Even though it might appear as an image in the Data Editor, the image URL will be passed to the JavaScript column.

2 Likes

It works ! Tank’s a lot.

This topic was automatically closed 24 hours after the last reply. New replies are no longer allowed.