The Movie Database-ondersteuning

How do I access the backdrop image in a foreach statement

foreach ($search as $result) {  
    $movies[] = [
        'title' => $result->getTitle(),
        'image' => $result->getPoster(),
        'backdrop'=> $result->_data['backdrop'] // doesn't work because it's private
    ];
}

1 antwoord (op pagina 1 van 1)

Jump to last post

Hi @kirkdm When you say "private" it sounds like you're talking about the method in whatever language you are using. And if I was to guess, you're using a library of a sort? If so, you should contact the developer of the library.

The backdrop is just a field like any other, the backdrop_path field.

https://api.themoviedb.org/3/search/movie?api_key=###&query=inception

And looking at the first result...

{
  "poster_path": "/qmDpIHrmpJINaRKAfWQfftjCdyi.jpg",
  "adult": false,
  "overview": "Cobb, a skilled thief who commits corporate espionage by infiltrating the subconscious of his targets is offered a chance to regain his old life as payment for a task considered to be impossible: \"inception\", the implantation of another person's idea into a target's subconscious.",
  "release_date": "2010-07-14",
  "genre_ids": [
    28,
    53,
    878,
    9648,
    12
  ],
  "id": 27205,
  "original_title": "Inception",
  "original_language": "en",
  "title": "Inception",
  "backdrop_path": "/s2bT29y0ngXxxu2IA8AOzzXTRhd.jpg",
  "popularity": 8.313062,
  "vote_count": 9924,
  "video": false,
  "vote_average": 8
}

Film of tv-serie niet gevonden? Meld je aan om deze toe te voegen.

Wereldwijd

s focus op zoekbalk
p open profielmenu
esc sluit een open venster
? open sneltoetsen venster

Op media pagina's

b ga terug (of ga naar bovenliggend item)
e ga naar beweken

Op tv-seizoenspagina's

(rechter pijl) ga naar volgende seizoen
(linker pijl) ga naar vorig seizoen

Op pagina's met tv-series

(rechter pijl) ga naar volgende aflevering
(linker pijl) ga naar vorige aflevering

Op alle afbeeldingspagina's

a open venster afbeelding toevoegen

Op alle bewerkte pagina's

t open vertaalmenu
ctrl+ s verstuur formulier

Op discussiepagina's

n start nieuwe discussie
w Verander kijk status
p privé of openbaar
c schakelen sluiten/openen
a open activiteit
r beantwoord discussie
l ga naar laatste antwoord
ctrl+ enter verstuur uw bericht
(rechter pijl) volgende pagina
(linker pijl) vorige pagina

Instellingen

Want to rate or add this item to a list?

Inloggen