dsf5632 2013-06-11 13:39
浏览 68
已采纳

如何检索Google+ oAuth2个人资料缩略图

After a long learning curve, I managed to successfully get the user's profile information using the Google API client libraries.

Along with a name and email address, when the user logs in to my web app, I can get their profile picture.

Trouble is, the picture is pretty big, in dimension and bytes. The url for such a picture looks something like this:

https://lh4.googleusercontent.com/-rdhxDPbmVhg/AAAAAAAAAAI/AAAAAAAAAJQ/6Dsr5psyQPs/photo.jpg

(Yes, that is me at Coral Castle).

Is there a way to get a thumbnail or icon-sized profile pic, like the kind I see next to the author in the results of a Google search? I notice these aren't a URL, but a data object, so I will probably have to do something in php to render it as an image?

An example of the image info on an author, in the results list of a Google search, looks something like this:

data:image/jpeg;base64,/9j/4AAQSkZJRgABAQAAAQABAAD/4QBgRXhpZgAASUkqAAgAAAACADEBAgAHAAAAJgAAAGmHBAABAAAALgAAAAAAAABQaWNhc2EAAAMAAJAHAAQAAAAwMjIwAqAEAAEAAAAsAAAAA6AEAAEAAAAsAAAAAAAAAP/bAIQAAwICAwICAwMDAwQDAwQFCAUFBAQFCgcHBggMCgwMCwoLCw0OEhANDhEOCwsVFhAUExQVFRcMDxcUFhQTFxQVEAEDBAQGBQYJBgYKEg0LDhIVEBAQFBEQEw8UDhUQFRAQDxAQDxEQFA8NEA8QDQ0QDw0ODBAQEAwMDBAPDw8MDA8P/8AAEQgALAAsAwERAAIRAQMRAf/EABkAAAMBAQEAAAAAAAAAAAAAAAYHCAkFAf/EADIQAAEDAwIEBAQFBQAAAAAAAAECAwQFBhEAIQcSMUETIlGBCCNxkRQyYZLBFTNSocL/xAAaAQACAwEBAAAAAAAAAAAAAAAEBQIDBgcB/8QALxEAAQMDAQQJBAMAAAAAAAAAAQACAwQRITEFEkFREyJhcYGRobHBFCPR8EJi4f/aAAwDAQACEQMRAD8AzPjsKlQ6iAQCGEn7vtJ/61DSytOiZPDHgA5xImRk0tmS/F5EeNIkHw0BePOBjGwPfOdKKiv6G4da/Ls4J3Q7MdUAG2Oaf1b+A56ZbzjdM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wprkp1TzcyFEkrRyq+alSAopwfXYHOq4WDfF9PhC1MpDHEageqkHjtw5pF30mFUKk6+mWuap1ciK2hLrylIVzKcUUkqz5M9D5RvnpoKd5jkeOAGnZjRY+Zom3OBcde08SuFaPw8WbIowVJo635AedQtanXVZKVkdlbYAG2iTVdJ1o7gcsXHevZaD6d5iebkcQDY4vi6T9lXbSLMqjsipBS47sZxrwhjzqJGM5I21HonSRSMGrhZDTlolheP4u3jz0Ix25RVwxvo0mh1BFNTLqEJh1YlPK5PD5MoUhQwonPXm9OZPXzECu2dI4Em2OX++KdDa0W8N0HPO3Pv1tYKruFXFK34sSP4clyRKcSUiKwlSnE+g5cbe+NK/p36OTZ1ZHa7U97Itx7iO3VEz21Q4LzS2VNEBXgNrSUkq7FZBOB/GmFLROneAzQan4HaktXXiBhc/U6D5Uo8ebiiUC559pNxXJEmLVH0pbV2ZQvyEHPXBT+7Vs8JZJIB3fvglVLXQEMdKSLEE4S0l1enNTJJRUqpHccdWtxqI4EISoqONt9+Xl++NRgiYGDfAv4/Bzy8AmNbtkSzF0Uh3MW6o0t/YX1ufFJywYcSoypQnxGZ7CUgmPIBKF9Tg4IPUDvphNgsAxql8ZvFKT2e6aPCWDBlcK1uNwI0QTXJ7jjbCMJHIlsAAEnY4Gc56DGNH5ZTyPBz+lLo7PmjYRgo94I1F2Bbi6k0EfjGo5KHFJzg6QTCxstNHkAquaNKVZFfuybTAA5CoUqQEOkqS8tnkU2XBkc2+T7n110EsbBT7rBhuQubzPdLIXuOTqoNZqcq4K1Xq9UX1zKq86ouSHdypR86j9SpRz7emsHK4m1+OSiHYACXNQqDzUlRSrdz5iie6judXNaCEaBhf/9k=

I welcome help in getting me to clarify the question, if needed.

  • 写回答

2条回答 默认 最新

  • doumi7861 2016-09-23 06:31
    关注

    Just pass a parameter for size to the URL ?sz=200

    It will become something like https://lh3.googleusercontent.com/--sahsjak8sjdbs5kNk/AAAAdshjgdshdgAAI/AAAAsdhsHY/knQ6LGqP1Yk/photo.jpg?sz=200

    And you are good to go!

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(1条)

报告相同问题?

悬赏问题

  • ¥15 freertos下使用外部中断失效
  • ¥15 输入的char字符转为int类型,不是对应的ascall码,如何才能使之转换为对应ascall码?或者使输入的char字符可以正常与其他字符比较?
  • ¥15 devserver配置完 启动服务 无法访问static上的资源
  • ¥15 解决websocket跟c#客户端通信
  • ¥30 Python调用dll文件输出Nan重置dll状态
  • ¥15 浮动div的高度控制问题。
  • ¥66 换电脑后应用程序报错
  • ¥50 array数据同步问题
  • ¥15 pic16F877a单片机的外部触发中断程序仿真失效
  • ¥15 Matlab插值拟合差分微分规划图论