如何从moviedb api中获取图像

问题描述

我从themoviedb API获得以下JSON响应:

{
         "popularity":1640.159,"Vote_count":32,"video":false,"poster_path":"\/9Rj8l6gElLpRL7Kj17iZhrT5Zuw.jpg","id":734309,"adult":false,"backdrop_path":"\/7fvdg211A2L0mHddvzyArRuRalp.jpg","original_language":"en","original_title":"Santana","genre_ids":[
            28
         ],"title":"Santana","Vote_average":6.3,"overview":"Two brothers — one a narcotics agent and the other a general — finally discover the identity of the drug lord who murdered their parents decades ago. They may kill each other before capturing the bad guys.","release_date":"2020-08-28"
      }

我必须使用poster_path,但由于它只是图像名称而不是任何路径,因此我无法理解。我不知道如何从这个poster_path字符串中获取图像。

请帮助我!当我将网址粘贴到Google时,我一无所获。

解决方法

根据 the movie db doc,其格式如下:-

http://image.tmdb.org/t/p/w500/your_poster_path

(从问题中获取张贴者的路径,现在您可以通过将其粘贴到浏览器中作为URL-http://image.tmdb.org/t/p/w500/9Rj8l6gElLpRL7Kj17iZhrT5Zuw.jpg来查看图像)

使用Glide或毕加索通过遵循其他答案来显示它。

,

您可以使用glide库从服务器获取并显示图像。检查以下网址。
-https://bumptech.github.io/glide/ 包含如何使用滑行。

 Glide
        .with(may be context)
        .load(url)
        .into(your Image View);