I used this Pinterest button on my blog
我在博客上使用了这个Pinterest按钮
<li><a class='pinterest share-tooltip share-tooltip-top' data-share-tooltip='Share on Pinterest' expr:href='"http://pinterest.com/pin/create/button/?url=" + data:post.url + "&media=" + data:post.firstImageUrl + "&description=" + data:post.title' target='_blank'><i class='fa fa-pinterest'/>Pinterest</a></li>
as you can see I'm using data:post.firstImageUrl as the source of the image ... but the problem is i made my fist image doesn't show in a full size only a thumbnail (medium size) ... so when i used this data:post.firstImageUrl ... the image that being shared only a thumbnail not the real one
你可以看到我正在使用数据:post.firstImageUrl作为图像的来源...但问题是我的拳头图像没有以完整尺寸显示只有缩略图(中等大小)......所以当我使用这个数据时:post.firstImageUrl ...只共享缩略图而不是真实缩略图的图像
here is the sample of thumbnail URL which i got from data:post.firstImageUrl
这是我从数据中获取的缩略图URL示例:post.firstImageUrl
https://3.bp.blogspot.com/-W-g2qYS-Kh0/V5gs0FvhpKI/AAAAAAAAFSY/yh_3p00aSA4-fRa65NH4cQ83iEngZhDeACLcB/s640/BMW-M5-30-Jahre-2014-1.jpg
and here is the full size image URL that i want
这是我想要的完整尺寸图像网址
https://3.bp.blogspot.com/-W-g2qYS-Kh0/V5gs0FvhpKI/AAAAAAAAFSY/yh_3p00aSA4-fRa65NH4cQ83iEngZhDeACLcB/s1600/BMW-M5-30-Jahre-2014-1.jpg
as you can see the different only come to this part xxx://xxx/xxx/s640/xxx and xxx://xxx/xxx/s1600/xxx ...
你可以看到不同的只有这个部分xxx:// xxx / xxx / s640 / xxx和xxx:// xxx / xxx / s1600 / xxx ...
my question is how do i change this URL part s640 into this s1600 and how to assign it into my pinterest button ?
我的问题是如何将此URL部分s640更改为此s1600以及如何将其分配到我的pinterest按钮?
i had been seen someone using a JavaScript to change this URL part /s640/, he used it for auto resize thumbnail, I'm not familiar with JavaScript so I'm not really understand it, here is the code
我曾经看到有人使用JavaScript来改变这个URL部分/ s640 /,他用它来自动调整大小缩略图,我不熟悉JavaScript所以我不是很了解它,这里是代码
img src="'+image_url.replace('/s72-c/','/s'+image_size+'-c/')+'" alt="'+post_title+'"/
1 个解决方案
#1
0
You can use script from this pastie. But it need a bit change.
你可以使用这个贴纸的脚本。但它需要一点改变。
<script type='text/javascript'>
//<![CDATA[
function thumbnail_resize(image_url) {
var image_size = 1600;
image_tag = image_url.replace('/s640/','/s' + image_size + '/');
if(image_url != "") {
return image_tag;
} else {
return "";
}
}
//]]>
</script>
Here we replaced the URL of image.
在这里,我们替换了图像的URL。
<script type='text/javascript'>document.write('<a class="pinterest share-tooltip share-tooltip-top" data-share-tooltip="Share on Pinterest" href="http://pinterest.com/pin/create/button/?url=<data:post.url/>&media=' + thumbnail_resize("<data:post.firstImageUrl/>") + '&description=<data:post.title/>">PING</a>');</script>
And here we pasted the link via JavaScript.
在这里,我们通过JavaScript粘贴链接。
#1
0
You can use script from this pastie. But it need a bit change.
你可以使用这个贴纸的脚本。但它需要一点改变。
<script type='text/javascript'>
//<![CDATA[
function thumbnail_resize(image_url) {
var image_size = 1600;
image_tag = image_url.replace('/s640/','/s' + image_size + '/');
if(image_url != "") {
return image_tag;
} else {
return "";
}
}
//]]>
</script>
Here we replaced the URL of image.
在这里,我们替换了图像的URL。
<script type='text/javascript'>document.write('<a class="pinterest share-tooltip share-tooltip-top" data-share-tooltip="Share on Pinterest" href="http://pinterest.com/pin/create/button/?url=<data:post.url/>&media=' + thumbnail_resize("<data:post.firstImageUrl/>") + '&description=<data:post.title/>">PING</a>');</script>
And here we pasted the link via JavaScript.
在这里,我们通过JavaScript粘贴链接。