Assistance de TMDB

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 réponses (sur la page 1 sur 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?

Un film, une émission télévisée ou un artiste est introuvable ? Connectez-vous afin de créer une nouvelle fiche.

Général

s Mettre le curseur dans la barre de recherche
p Ouvrir le menu du profil
esc Fermer une fenêtre ouverte
? Ouvrir la fenêtre des raccourcis clavier

Sur les pages des médias

b Retour (ou vers le parent si faisable)
e Afficher la page de modification

Sur les pages des saisons des émissions télévisées

Afficher la saison suivante (flèche droite)
Afficher la saison précédente (flèche gauche)

Sur les pages des épisodes des émissions télévisées

Afficher l'épisode suivant (flèche droite)
Afficher l'épisode précédent (flèche gauche)

Sur toutes les pages des images / photos

a Ouvrir la fenêtre d'ajout d'image / photo

Sur toutes les pages de modifications

t Ouvrir le sélecteur de traduction
ctrl+ s Envoyer le formulaire

Sur les pages des discussions

n Créer une nouvelle discussion
w Basculer le statut de suivi
p Basculer publique / privée
c Basculer fermer / ouvrir
a Ouvrir l'activité
r Répondre à la discussion
l Afficher la dernière réponse
ctrl+ enter Envoyer votre message
Page suivante (flèche droite)
Page précédente (flèche gauche)

Paramètres

Vous souhaitez évaluer ou ajouter cet élément à une liste ?

Connexion