Photoswipe Photosweep-如何使自定义pid工作

Photoswipe Photosweep-如何使自定义pid工作,photoswipe,Photoswipe,我正在用Photosweep构建一个网站,它很不错,并且有深度链接的实现,但是这个pid gid实现的唯一问题是,如果有人使用哈希将你的照片链接到某个地方,而你将从你的图库中删除该照片,linkt将指向另一张在图库中具有相同pid/索引的照片 网站上的pid始终获取值1,2,3,4,5,6,7,8 我试图以某种方式强制Photosweep从某个属性获取pid,或者至少在之前通过从自定义值到真实图像索引的映射对其进行解析,但我有点失败了 有人尝试过这样的实现并成功了吗 thx提前您可以查看 摘自该

我正在用Photosweep构建一个网站,它很不错,并且有深度链接的实现,但是这个pid gid实现的唯一问题是,如果有人使用哈希将你的照片链接到某个地方,而你将从你的图库中删除该照片,linkt将指向另一张在图库中具有相同pid/索引的照片

网站上的pid始终获取值1,2,3,4,5,6,7,8

我试图以某种方式强制Photosweep从某个属性获取pid,或者至少在之前通过从自定义值到真实图像索引的映射对其进行解析,但我有点失败了

有人尝试过这样的实现并成功了吗

thx提前

您可以查看

摘自该页面,下面的摘录展示了如何自定义url、文本、图像url和原始图像url属性。(只需重写getter方法即可。)


实际上,由于Photosweep版本支持自定义pid,所以询问图像pid,但不幸的是,您将所有内容粘贴在pid部分旁边:)
// Share buttons
// 
// Available variables for URL:
// {{url}}             - url to current page
// {{text}}            - title
// {{image_url}}       - encoded image url
// {{raw_image_url}}   - raw image url
shareButtons: [
    {id:'facebook', label:'Share on Facebook', url:'https://www.facebook.com/sharer/sharer.php?u={{url}}'},
    {id:'twitter', label:'Tweet', url:'https://twitter.com/intent/tweet?text={{text}}&url={{url}}'},
    {id:'pinterest', label:'Pin it', url:'http://www.pinterest.com/pin/create/button/?url={{url}}&media={{image_url}}&description={{text}}'},
    {id:'download', label:'Download image', url:'{{raw_image_url}}', download:true}
],


// Next 3 functions return data for share links
// 
// functions are triggered after click on button that opens share modal,
// which means that data should be about current (active) slide
getImageURLForShare: function( shareButtonData ) {
    // `shareButtonData` - object from shareButtons array
    // 
    // `pswp` is the gallery instance object,
    // you should define it by yourself
    // 
    return pswp.currItem.src || '';
},
getPageURLForShare: function( shareButtonData ) {
    return window.location.href;
},
getTextForShare: function( shareButtonData ) {
    return pswp.currItem.title || '';
},