The Movie Database Support

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 replies (on page 1 of 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.

Can't find a movie or TV show? Login to create it.

Global

s focus the search bar
p open profile menu
esc close an open window
? open keyboard shortcut window

On media pages

b go back (or to parent when applicable)
e go to edit page

On TV season pages

(right arrow) go to next season
(left arrow) go to previous season

On TV episode pages

(right arrow) go to next episode
(left arrow) go to previous episode

On all image pages

a open add image window

On all edit pages

t open translation selector
ctrl+ s submit form

On discussion pages

n create new discussion
w toggle watching status
p toggle public/private
c toggle close/open
a open activity
r reply to discussion
l go to last reply
ctrl+ enter submit your message
(right arrow) next page
(left arrow) previous page

Settings

Want to rate or add this item to a list?

Login