How do I display this image on my React site?

Asked

Viewed 253 times

-3

I created a Rest API to return an image of my Amazon S3 Bucket. but the image came in a strange format and I can’t see it on my page. The strange thing is that when I perform a get on Postman the image usually appears there on his interface.

Imagem de como aparece pra mim no console

  • Check the headers, I see it’s application/json, but it should be something like this: Accept: image/png,image/svg+xml,image depends on the file extension you are using.

  • And how are you reading in your code ? Post the code you’re making.

  • I’m getting this value inside a variable and wanted to pass it inside a <img> tag in React, but if that’s why in src it only loads an image without content

  • This date field there looks like a Base64 image. You tried to include the image this way?

  • yes, I tried that and dps all possible things, just know that the image really is there because the Postman is displaying it normally

1 answer

-1

Problem solved, I only include "data:image/jpeg;Base64," at the beginning of the date content and the problem has been solved

Browser other questions tagged

You are not signed in. Login or sign up in order to post.