1
My image is saved in the database. When I take it and give it a dd it returns which is a Resource stream, so I’m using the following code to get the content from it:
stream_get_contents($data['img'])
And it returns the Contents of this image in Base64, I believe, because it returns several letters and numbers together.
I wonder how I can render this image
Take a look here and here. I believe these answers can help you
– Alvaro Alves
or try it like this:

$contents = stream_get_contents($data['img']);
$base64 = 'data:image/PNG;base64,' . base64_encode($contents);
echo "<img src=$base64 />" ;
– Alvaro Alves
I tried something like= Return base64_decode(stream_get_contents($data['img'])); and appeared: PNG Ihdrrro& U1idatx 1 @ O B! ½ = K$ $K % D
I"�$�X�H,I$�$K �%���D
I" $ X H,I$ $K % DI"�$�X�H,I$�$K �%���D
I" $ X H,I$ $K % DI"�$�X�H,I$�$K �%���D
I" $ need to return without the <img> tag as I am creating an api– Ana Alice
In case, will you recover this data via a link in the API Routes? This API will be consumed in PHP?
– Alvaro Alves
No. The api is in php, the image is in the database, I’m doing the api. I gave a select on the image and now I want to return to create a server link with this rendered image. A React application will consume my api
– Ana Alice