【问题标题】:How can I make People.GetBatchGet() return photos of a certain size如何让 People.GetBatchGet() 返回特定尺寸的照片
【发布时间】:2019-07-23 11:19:08
【问题描述】:

我目前正在使用 PeopleService.People.GetBatchGet() 来返回提供的批次中用户的所有照片。我使用的方法返回尺寸设置为 100 的照片。我想知道是否可以接收不同尺寸的照片。

// peopleService is an object of type PeopleServiceService

var connection = peopleService.People.GetBatchGet();
connection.PersonFields = "photos";
connection.ResourceNames = resourceNames;

var result = connection.Execute();

result.ResponsesPersonResponse 对象的列表。

因此,例如,result.Responses[0].Person.Photos[0].Url 将具有如下值:'https://lh4.googleusercontent.com/somecharacters/s100/photo.jpg'。

我注意到's100'实际上是图片的大小,如果我将其修改为另一个值,则来自url的图片将具有该大小。

我想知道是否有任何方法可以使该方法返回不同大小的照片(可能向connection 添加一个参数)。

【问题讨论】:

    标签: c# google-api google-api-dotnet-client google-people-api


    【解决方案1】:

    peopleService.People.GetBatchGet() 返回一个人物对象,其中包含一个照片对象photo

    {
      "metadata": {
        object (FieldMetadata)
      },
      "url": string,
      "default": boolean
    }
    

    这些图片为标准尺寸,无法更改。该 api 不提供更改返回图像大小的选项。

    您可能会考虑将其作为功能请求添加到问题跟踪器https://issuetracker.google.com/issues?q=componentid:344199%2B

    【讨论】:

      猜你喜欢
      • 2013-05-28
      • 1970-01-01
      • 2017-01-23
      • 2015-12-31
      • 2014-02-11
      • 2014-11-23
      • 1970-01-01
      • 2012-10-11
      • 2011-08-31
      相关资源
      最近更新 更多