2012-03-30 66 views
0

我在查詢Picasa圖庫,當我深入查看返回的條目時,找不到完整大小的圖像。我只能看到一個更小,重新大小的圖像(data[0].Content.AbsoluteUri)。我知道Google保留了全尺寸圖片,因爲我可以在線查看我的Picasa圖庫時看到它。全尺寸圖像在哪裏?GData.Photos查詢全尺寸圖像在哪裏?

var picasaService = new PicasaService("Gallery"); 

var photoQuery = new PhotoQuery(PicasaQuery.CreatePicasaUri("GOOGLEUSERNAME", "GALLERYID")); 
var photoFeed = picasaService.Query(photoQuery); 

var data = photoFeed.Entries; 

回答

1

簡短的回答:

媒體:組/媒體:內容[@url]在查詢得到通過Picasa的GData服務GDATA照片ENTRY路徑中包含你想要的鏈接。

較長的答案:

  1. 使用OAuth操場交互查詢GDATA API的Picasa \
  2. https://code.google.com/oauthplayground並從列表中選擇Picasa和獲得
  3. 授權按鈕......然後允許訪問按鈕並且您可以使用表格
  4. 查詢所需照片的ENTRY URI(您的...用戶/ ../albumid ../photoid)
  5. 檢查的媒體內容:組/媒體:內容[@url]樣品下面
  6. 的URI到大照片是的valueOf在上述表達式中的URL屬性
  7. 爲我Picasa相片
  8. 一個採樣值
  9. URL = HTTPS://lh3.googleusercontent.com/-_FFMNGPU1TQ/TtukXyN4eCI/AAAAAAAACso/EzPmut2iKVQ/DSC01612.JPG

使用一個查詢的OAuth 2.0操場讓我的一張照片的進入.. 。

Request: 
GET /data/entry/api/user/rowntreerob/albumid/5682316071017984417/photoid/5682316083381958690?alt=json 

注:使用http://json.parser.online.fr/

Response: 

"media$group":{ 
"media$content":[ 
{ 
"url":"https://lh3.googleusercontent.com/-_FFMNGPU1TQ/TtukXyN4eCI/AAAAAAAACso/EzPmut2iKVQ/DSC01612.JPG", 
"height":512, 
"width":341, 
"type":"image/jpeg", 
"medium":"image" 
} 

的鏈接大照片要在URL屬性上面...

使用「域=」標籤濾波器響應,您可以直接獲得鏈接從下面GDATA REQ /防塵面具

GET /data/entry/api/user/rowntreerob/albumid/5682316071017984417/photoid/5682316083381958690?alt=json&fields=media%3Agroup%2Fmedia%3Acontent%5B%40url%5D 

{ 
"version":"1.0", 
"encoding":"UTF-8", 
"entry":{ 
"xmlns":"http://www.w3.org/2005/Atom", 
"xmlns$media":"http://search.yahoo.com/mrss/", 
"media$group":{ 
"media$content":[ 
{ 
"url":"https://lh3.googleusercontent.com/-_FFMNGPU1TQ/TtukXyN4eCI/AAAAAAAACso/EzPmut2iKVQ/DSC01612.JPG", 
"height":512, 
"width":341, 
"type":"image/jpeg", 
"medium":"image" 
} 
] 
} 
} 
} 
4

文檔中隱藏它可以指定在飼料中的圖像的大小。這是使用「imgmax」參數:

https://developers.google.com/picasa-web/docs/2.0/reference#Parameters

它可以有一個值設置爲「d」,要求全尺寸圖像

這不是C#API的直接支持,但你可以使用PhotoQuery對象上的「extraParameters」字段實現所需的結果。然後

您的代碼就變成了:

var picasaService = new PicasaService("Gallery"); 

var photoQuery = new PhotoQuery(PicasaQuery.CreatePicasaUri("GOOGLEUSERNAME", "GALLERYID")); 
// add the extra parameter to request full size images 
photoQuery.ExtraParameters = "imgmax=d"; 

var photoFeed = picasaService.Query(photoQuery); 

var data = photoFeed.Entries;