# Converting glides image url into a base64 string

**URL:** <https://community.glideapps.com/t/converting-glides-image-url-into-a-base64-string/77655>\
**Category:** Ask for Help\
**Created:** [November 6, 2024, 10:09am UTC](https://community.glideapps.com/t/converting-glides-image-url-into-a-base64-string/77655 "2024-11-06T10:09:51Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![MattGlides](https://avatars.discourse-cdn.com/v4/letter/m/53a042/32.png) [@MattGlides](https://community.glideapps.com/u/MattGlides)\
**Post date:** [November 6, 2024, 10:09am UTC](https://community.glideapps.com/t/converting-glides-image-url-into-a-base64-string/77655/1 "2024-11-06T10:09:51Z")

</div>

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?

---

<div class="post-metadata">

**Author:** ![Darren\_Murphy](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/darren_murphy/32/47326_2.png) [@Darren\_Murphy](https://community.glideapps.com/u/Darren_Murphy)\
**Post date:** [November 6, 2024, 10:59am UTC](https://community.glideapps.com/t/converting-glides-image-url-into-a-base64-string/77655/2 "2024-11-06T10:59:09Z")

</div>

You’d need to use a JavaScript column to download the image, encode it, and then return the encoded string.

---

<div class="post-metadata">

**Author:** ![Jeff\_Hager](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/jeff_hager/32/43_2.png) [@Jeff\_Hager](https://community.glideapps.com/u/Jeff_Hager)\
**Post date:** [November 6, 2024, 1:06pm UTC](https://community.glideapps.com/t/converting-glides-image-url-into-a-base64-string/77655/3 "2024-11-06T13:06:02Z")

</div>

Something like this?

```auto
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);

```

---

<div class="post-metadata">

**Author:** ![system](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/system/32/53398_2.png) [@system](https://community.glideapps.com/u/system)\
**Post date:** [November 13, 2024, 1:06pm UTC](https://community.glideapps.com/t/converting-glides-image-url-into-a-base64-string/77655/4 "2024-11-13T13:06:13Z")

</div>

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