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.
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>
Un film, une émission télévisée ou un artiste est introuvable ? Connectez-vous afin de créer une nouvelle fiche.
Vous souhaitez évaluer ou ajouter cet élément à une liste ?
Pas encore membre ?
Réponse de Travis Bell
le 20 juin 2019 à 16h37
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.
For example.
Réponse de ligiaas
le 20 juin 2019 à 21h04
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?
Réponse de ligiaas
le 21 juin 2019 à 14h06