- http://stackoverflow.com/questions/7352971/using-jquery-getjson-with-google-picasa-data-api
- https://developers.google.com/picasa-web/docs/2.0/developers_guide_protocol?hl=zh-TW
範例:
- json網址:2015年有改版,建議使用photos.googleapis.com的相關方法。
- https://picasaweb.google.com/data/feed/api/user/105327625201270500765/albumid/6015020452690553217?kind=photo&alt=json
- https://photos.googleapis.com/data/feed/api/user/105327625201270500765/albumid/6015020452690553217?kind=photo&alt=json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<html> | |
<head> | |
<title></title> | |
</head> | |
<body> | |
<script src="http://code.jquery.com/jquery-1.10.2.js"></script> | |
<script> | |
$(function () { | |
var rssurl = 'https://picasaweb.google.com/data/feed/api/user/105327625201270500765/albumid/6015020452690553217?kind=photo&alt=json'; | |
ShowPic(rssurl);; | |
}); | |
function ShowPic(rssurl) { | |
$.ajax({ | |
type: 'GET', | |
url: rssurl, | |
success: function (data) { | |
$.each(data.feed.entry, function (i, item) { | |
$('#images').append("Album Photos: <br />"); | |
//Photo URL | |
$.each(item.media$group.media$content, function (i, item) { | |
var photo_URL = item.url; | |
$('#images').append("Image Photo URL: <br/><img src='" + photo_URL + "'/><br />"); | |
}); | |
//Thumbnail URL | |
$.each(item.media$group.media$thumbnail, function (i, item) { | |
var photo_Thumb_URL = item.url; | |
$('#images').append("Image Thumbnail URL: <br/><img src='" + photo_Thumb_URL + "'/><br />"); | |
}); | |
//Photo Title | |
var photo_Title = item.media$group.media$title.$t; | |
$('#images').append("Image Photo_Title: " + photo_Title + '<br />'); | |
//Photo Description | |
var photo_Description = item.media$group.media$description.$t; | |
$('#images').append("Image Photo Description: " + photo_Description + '<br /><br />'); | |
}); | |
}, | |
dataType: 'json', | |
async: false | |
}); | |
} | |
</script> | |
<br /> | |
<div id="images"> | |
</div> | |
</body> | |
</html> |
DEMO: