Soporte de The Movie Database

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 respuesta (en la página 1 de 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
}

¿No encuentras una película o serie? Inicia sesión para crearla:

Global

s centrar la barra de búsqueda
p abrir menú de perfil
esc cierra una ventana abierta
? abrir la ventana de atajos del teclado

En las páginas multimedia

b retrocede (o a padre cuando sea aplicable)
e ir a la página de edición

En las páginas de temporada de televisión

(flecha derecha) ir a la temporada siguiente
(flecha izquierda) ir a la temporada anterior

En las páginas de episodio de televisión

(flecha derecha) ir al episodio siguiente
(flecha izquierda) ir al episodio anterior

En todas las páginas de imágenes

a abrir la ventana de añadir imagen

En todas las páginas de edición

t abrir la sección de traducción
ctrl+ s enviar formulario

En las páginas de debate

n crear nuevo debate
w cambiar el estado de visualización
p cambiar público/privado
c cambiar cerrar/abrir
a abrir actividad
r responder al debate
l ir a la última respuesta
ctrl+ enter enviar tu mensaje
(flecha derecha) página siguiente
(flecha izquierda) página anterior

Configuraciones

¿Quieres puntuar o añadir este elemento a una lista?

Iniciar sesión