Soporte de The Movie Database

Hi Travis,

I am working on an application that has an autocomplete function which makes a JSONP request as follows:

http://api.themoviedb.org/3/search/movie?api_key=[API_key_here]&query=[search_term]

where the "search_term" comes from the autocomplete function. I want to be able to display the poster image for each of the search results (to do this, I need: base_url, size and file_path, according to the configuration documentation). However, I notice that the above search only returns the file_path for the poster, and to display the image I still need the "size" Is there any way to do this without making another xhr request? If I try to get the image without the size parameter (http://cf2.imgobject.com/t/p/bgSHbGEA1OM6qDs3Qba4VlSZsNG.jpg) it obviously does not work.

Thanks in advance for the help!

3 respuestas (en la página 1 de 1)

Jump to last post

To add to the above, if I use a generalized url as follows:

http://cf2.imgobject.com/t/p/w500/8uO0gUM8aNqYLs1OsTBQiXu0fEv.jpg

where I specify the size as w500, I see that this works for all the posters. The problem is, since the size of the file is pretty large, the images get added to the search results of the autocomplete function with a significant lag after the results are loaded. To overcome this issue, I think I need to get the smallest file or something like a thumbnail for the image. Is this possible?

However, I notice that the above search only returns the filepath for the poster, and to display the image I still need the "size" Is there any way to do this without making another xhr request?

Just make the request once, and then cache it for repeated use. That data isn't likely to change often, so you could even store it semi-permanently in a cookie if you so desired. The documentation explicitly recommends you store it in some manner. RFC2109 dictates at minimum 4096 bytes be available for use per-cookie, so there would be plenty of storage room on any standards compliant browser.

The problem is, since the size of the file is pretty large

Remember there are multiple sizes you can request. Check out the configuration method for more details.

¿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