我正在使用jQuery-Image-Gallery jQuery插件。它是一個全屏jQuery照片庫。我下載了它,並且在演示中工作正常。它使用ajax請求將圖像加載到flickr。具體如下:如何使用jQuery Image Gallery插件加載本地圖片
$.ajax({
url: 'http://api.flickr.com/services/rest/',
data: {
format: 'json',
method: 'flickr.interestingness.getList',
api_key: '7617adae70159d09ba78cfec73c13be3'
},
dataType: 'jsonp',
jsonp: 'jsoncallback'
}).done(function (data) {
var gallery = $('#gallery'),
url;
$.each(data.photos.photo, function (index, photo) {
url = 'http://farm' + photo.farm + '.static.flickr.com/' +
photo.server + '/' + photo.id + '_' + photo.secret;
$('<a rel="gallery"/>')
.append($('<img>').prop('src', url + '_s.jpg'))
.prop('href', url + '_b.jpg')
.prop('title', photo.title)
.appendTo(gallery);
});
});
這是工作完美。但是我想在images/photos
文件夾中顯示我的本地文件(在我的本地主機/服務器上)。我有PHP服務器。我怎樣才能做到這一點?
我想知道Ajax JSON回調結構,以便我們可以使用自定義PHP文件人爲地重新創建它。
你有什麼路徑結構,以圖像文件夾> –
它僅僅是一個名爲圖片文件夾中的照片子文件。它包含img1.jpg,img2.jpg,img3.jpg等。 –