45
Views
8
Comments
Solved
Getting Url from binary data to use it externally as a link

Hi

I need a URL of binary data that is saved in database. So I can use it in  API response which later can be used as "src" link. Something like we do in html e.g.  <img src=""> 

P.S I am not going to use this link in outsystems app. It is going to be use externally. I am just exposing the api here with image as a URL

2024-12-18 16-06-42
Junaid Syed
Solution

Not sure how you have structured your API, here is what I meant

REST API returning Image based on the provided Image Identifier




API consumed in sample HTML

This displays the image perfectly.

Hope it helps!

Junaid

2024-12-18 16-06-42
Junaid Syed

Hi Syeda,

If I understand your situation correctly you already have the images stored as binary in your database. Now you want to expose those images through REST APIs. In that case the API endpoint url itself becomes the URL.

Hope it helps!

Junaid

UserImage.jpg
Syeda Muhammad Arika Masroor

Okay got it. Thanks @Junaid Syed 

UserImage.jpg
Syeda Muhammad Arika Masroor

Hi @Junaid Syed .As  you said the api end point is my link.I need to use it something like this

But as can see no image is shown( I am testing through W3school).It is giving me response in the API but here it is not fetching it.

Please help me with this

2019-01-07 16-04-16
Siya
 
MVP

Your API is returning data like "{"Photo":"iVBORw0KGgo...." which you cannot give as a source to img. This has to be in the format like "data:image/png;base64,iVBORw0KGgoAAAANS..." in order to render. 

2024-12-18 16-06-42
Junaid Syed
Solution

Not sure how you have structured your API, here is what I meant

REST API returning Image based on the provided Image Identifier




API consumed in sample HTML

This displays the image perfectly.

Hope it helps!

Junaid

UserImage.jpg
Syeda Muhammad Arika Masroor
UserImage.jpg
Syeda Muhammad Arika Masroor
Community GuidelinesBe kind and respectful, give credit to the original source of content, and search for duplicates before posting.