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!
Can't find a movie or TV show? Login to create it.
Want to rate or add this item to a list?
Not a member?
Reply by kavi
on October 20, 2012 at 6:45 AM
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?
Reply by Raymond Wagner
on October 20, 2012 at 1:48 PM
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.
Reply by Travis Bell
on October 20, 2012 at 2:24 PM
Remember there are multiple sizes you can request. Check out the configuration method for more details.