Supporto The Movie Database

Hi I'm having trouble rendering the backdrop_path and poster_path image in my application. The call returns 200 but when I try to display the image the return is with error 500.

Console image

It's the first time I'm using TMDB so any help is welcome. Thank you all.

Here is the call:

https://api.themoviedb.org/3/movie/550?api_key={my_api_key}&language=en-US

Callback:

{adult: false, backdrop_path: "/mMZRKb3NVo5ZeSPEIaNW9buLWQ0.jpg", belongs_to_collection: null,…}

I'm using Reactjs to build a menu page similar to that of Netflix. Please disregard indentation errors. My code:

<div className="container">
   <div className="row">
     {movies.map(item => (
         <div className="" key={item.data.id}>
             <p>{item.data.title}</p>
             <img src={item.data.backdrop_path} alt={item.data.title} className="d-block w-100" />
        </div>
      ))}
    </div>
</div>

3 risposte (nella pagina 1 di 1)

Jump to last post

Hi @ligiaas, that console error shows you trying to load the image from your localhost server, which I suspect is not what you want to be doing.

You can read the docs here, that describe how you can build a valid image URL.

<img src=https://image.tmdb.org/t/p/w500{item.data.backdrop_path} alt={item.data.title} className="d-block w-100" />

For example.

And how do I render the most popular movie images? Render listing images in general?

The sure thing would be to get the url from the movie and not from localhost, right?

@travisbell please helpe me again! And how do I render the most popular movie images? Render listing images in general? The sure thing would be to get the url from the movie and not from localhost, right?

Non riesci a trovare un film o una serie Tv? Accedi per crearlo.

Globale

s focalizza la barra di ricerca
p apri menu profilo
esc chiudi una finestra aperta
? apri finestra scorciatoia tastiera

Su tutte le pagine di media

b torna indietro (o al precedente quando applicabile)
e vai alla pagina di modifica

Nelle pagine delle stagioni TV

(freccia destra) vai alla stagione successiva
(freccia sinistra) vai alla stagione precedente

Nelle pagine degli episodi TV

(freccia destra) vai all'episodio successivo
(freccia sinistra) vai all'episodio precedente

Su tutte le pagine di immagini

a apri finestra aggiungi immagine

Su tutte le pagine di modifica

t apri selettore traduzione
ctrl+ s invia modulo

Sulle pagine di discussione

n crea nuova discussione
w segna come visto/non visto
p cambia publico/privato
c cambia chiuso/aperto
a apri attivita
r rispondi alla discussione
l vai all'ultima risposta
ctrl+ enter invia il tuo messaggio
(freccia destra) pagina successiva
(freccia sinistra) pagina precedente

Impostazioni

Vuoi valutare o aggiungere quest'elemento a una lista?

Accedi