I was doing something like this before, and using jsonp which I understand is no longer supported $('#poster').html('<h2>Here is your poster </h2><img id="thePoster" src=' + json.results[0].posters[0].image.url+ '/> ')
Un film, une émission télévisée ou un artiste est introuvable ? Connectez-vous afin de créer une nouvelle fiche.
Vous souhaitez évaluer ou ajouter cet élément à une liste ?
Pas encore membre ?
Réponse de Travis Bell
le 6 mars 2014 à 09h03
Hi Tony007,
JSONP is still supported, what makes you think it's not?
Réponse de tony007
le 6 mars 2014 à 09h09
I thought that's what I read in the API, at any rate my code doesn't work like it did in v2, any ideas on displaying poster images? I see it's call poster_path now and something called backdrop_path where as before there as a actual poster object to work with
Réponse de Travis Bell
le 6 mars 2014 à 09h18
Hi Tony007,
Take a look at the configuration method to understand how to build URLs. You'll also want to make sure to append the
callback=
param or make sure to set dataType to 'jsonp'in jQuery to use JSONP.You can see a little jQuery test I have here of a working JSONP example: http://dev.travisbell.com/play/tmdb.html
Cheers.
Réponse de tony007
le 6 mars 2014 à 09h26
Thanks Travis, I appreciate the help
Réponse de tony007
le 6 mars 2014 à 12h32
I'm not seeing how to use the configuration object. I'm also following a tutorial I did a couple of years ago and it's using the $getJSON method.Does that make a difference?
$.getJSON('http://api.themoviedb.org/3/search/movie?api_key=apiKey&query=' + $('#input').val() + '&callback=?', function(json) { $('#poster').html('<h2>Here is your poster</h2>;<img src=' + json[0].posters[0].image_url + '/>') }
That was how I did it using the old API ( building the path ) how do I build the path with the new API, this is were it's failing for me
Réponse de tony007
le 6 mars 2014 à 13h08
Here is a gist of the js https://gist.github.com/anthonybrown/9395761
Réponse de Travis Bell
le 6 mars 2014 à 15h02
Hi Tony,
As described in the documentation:
You'll see that the configuration method returns the
base_url
and valid sizes for each image type. You can see that information combined with a (for example)poster_path
to build a vlid image URL.Réponse de tony007
le 6 mars 2014 à 16h30
I'll look into that, I got it to work though, check it out http://anthonybrown.github.io/movie-poster/?