我在与社交媒体(Facebook,Twitter等)共享图像时遇到问题,因为该图像是一个弹出图像,这意味着它不会显示在单独的链接中,所以我无法共享完整的url,并且图像标签的源指向我的存储的另一个问题是图像代码:
<div class="col-xs-12 col-sm-6 col-md-4 col-lg-3">
<a class="fancybox-buttons img-holder small-img" rel="gallery" title="" data-fancybox-group="button" href="/storage/galleries/{{$gallery->image}}">
<img src="/storage/galleries/{{$gallery->image}}" alt="img">
</a>
</div>
这是弹出窗口的Js代码
$('.fancybox-buttons').fancybox({
openEffect : 'none',
closeEffect : 'none',
prevEffect : 'none',
nextEffect : 'none',
closeBtn : false,
helpers : {
title : {
type : 'inside'
},
buttons : {}
},
afterLoad : function() {
this.title = '<a href="https://www.facebook.com/sharer/sharer.php?u={{ urlencode(Request::fullUrl()) }}" class="btn btn-fb btn-small"><i class="fa fa-facebook right-fa"></i> Share</a>' +
'<a href="https://twitter.com/intent/tweet?url={{ urlencode(Request::fullUrl()) }}" class="btn btn-tw btn-small"><i class="fa fa-twitter right-fa"></i> Share</a>' +
'<a href="https://plus.google.com/share?url={{ urlencode(Request::fullUrl()) }}" class="btn btn-inst btn-small"><i class="fa fa-instagram right-fa"></i> Share</a>';
}
});