[Facebook] プロフィール画像のURLを色んなサイズで取得する
Facebookでプロフィール写真のURLを取得する方法をまとめてみました。
まず、プロフィール画像を取得する基本的なURL。
http://graph.facebook.com/ユーザID/picture |
下記のように、画像サイズを指定することもできるみたいです。
http://graph.facebook.com/ユーザID/picture?type=large |
typeパラメータに指定できる値は、4通りです。
・square (50x50) ・small (50 pixels wide, variable height) ・normal (100 pixels wide, variable height) ・large (about 200 pixels wide, variable height) |
また、return_ssl_resources=1 というパラメータをつけるとSSLで画像のURLが取得できます。
http://graph.facebook.com/ユーザID/picture?return_ssl_resources=1 |
単純に、https://で始めてもOKみたい。
https://graph.facebook.com/ユーザID/picture |
以下、情報ソース(Facebook公式)です。
You can specify the picture size you want with the type argument, which should be one of square (50×50), small (50 pixels wide, variable height), normal (100 pixels wide, variable height), and large (about 200 pixels wide, variable height):
http://graph.facebook.com/bakorer/picture?type=large
If you need a picture to be returned over a secure connection, you can set the return_ssl_resources argument to 1:
http://graph.facebook.com/bakorer/picture?return_ssl_resources=1
以上です。