Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

201
Visualizações
Can't display image from API call React Js

I'm trying to display images from API call, response.json() returns img sources as

{"imgSrc":"/rimg/source/cars/v/1.jpg?crop=false&width=55&height=92&fallback=default3.png&_v=45788f99e6dcc"

}

and when I use it as src, images are broken and are not displayed. Any help and advise is greatly appreciated.

about 4 years ago · Juan Pablo Isaza
1 Respostas
Responde à pergunta

0

This is because the images locations returned are relative. You have 2 possible solutions:

  • Either you make your server return the complete address of the images (with the server's address/domain name)
  • Or you just add it to the response in the frontend

Both should make the returned locations absolute (with the server's address/domain name on it). Thus, the images locations should look like this:

{"imgSrc":"https://myServer.com/rimg/source/cars/v/1.jpg?crop=false&width=55&height=92&fallback=default3.png&_v=45788f99e6dcc"}
about 4 years ago · Juan Pablo Isaza Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda