如何允许我的用户下载在我的博客文章中上传的图片?
在页面上禁用了右键单击功能。因此,用户无法使用右键单击进行下载。
我想创建一个链接或按钮,例如
<a class="btnlink4" href="#">Download this Image.</a>
通常,我的博客文章只有一张图片。
答案 0 :(得分:1)
对于上传到Blogger本身的图像,在图像URL的末尾添加查询参数 ?dl=1
将导致强制下载它们。另一种方法是,在图像URL的大小参数后加-d
(又称s1600
),例如-
<a href="https://1.bp.blogspot.com/-k1bwGQauV6I/WLyURMAuU9I/AAAAAAAAAD0/k_ZcX4sr_bENoB2P3P8MTEfN-ymfa3_ugCLcB/s1600/en_Contempo.jpg?dl=1">Download this Image.</a>
<a href="https://1.bp.blogspot.com/-k1bwGQauV6I/WLyURMAuU9I/AAAAAAAAAD0/k_ZcX4sr_bENoB2P3P8MTEfN-ymfa3_ugCLcB/s1600-d/en_Contempo.jpg">Download this Image.</a>
答案 1 :(得分:0)
您可以使用download
标签的href
属性的anchor
属性。它将下载图像。首先,当您上传图片时,您会获得一个链接,该链接将图片上传到这样的地方:
<div class="separator" style="clear: both; text-align: center;">
<a href="https://3.bp.blogspot.com/-GfBiEDZvfKo/W9iND3nZniI/AAAAAAAAASY/ZEo4RIBwDkQBOQsEPecPZJ9pBQDiqOdcgCPcBGAYYCw/s1600/Google%2BAdSense.jpg" imageanchor="1" style="clear: right; float: right; margin-bottom: 1em; margin-left: 1em;">
<img border="0" data-original-height="161" data-original-width="293" height="174" src="https://3.bp.blogspot.com/-GfBiEDZvfKo/W9iND3nZniI/AAAAAAAAASY/ZEo4RIBwDkQBOQsEPecPZJ9pBQDiqOdcgCPcBGAYYCw/s320/Google%2BAdSense.jpg" width="320" />
</a>
</div>
您需要做的是,在锚标签的末尾添加download
一词,并在图像网址中添加href
,如下所示:
<a href="IMAGE-URL" download>Download Image</a>
^^^^^^^^
此处的示例:
This is the image:
<div class="separator" style="clear: both; text-align: center;">
<a href="https://3.bp.blogspot.com/-GfBiEDZvfKo/W9iND3nZniI/AAAAAAAAASY/ZEo4RIBwDkQBOQsEPecPZJ9pBQDiqOdcgCPcBGAYYCw/s1600/Google%2BAdSense.jpg" imageanchor="1" style="clear: right; margin-bottom: 1em; margin-left: 1em;">
<img height="174" src="https://3.bp.blogspot.com/-GfBiEDZvfKo/W9iND3nZniI/AAAAAAAAASY/ZEo4RIBwDkQBOQsEPecPZJ9pBQDiqOdcgCPcBGAYYCw/s320/Google%2BAdSense.jpg" width="320" />
</a>
</div>
Download link
<a href="https://3.bp.blogspot.com/-GfBiEDZvfKo/W9iND3nZniI/AAAAAAAAASY/ZEo4RIBwDkQBOQsEPecPZJ9pBQDiqOdcgCPcBGAYYCw/s320/Google%2BAdSense.jpg" download>Click here to download it</a>