jquery图片水印插件
源码介绍
Img2Blob.js是一款可以为图片添加自定义水印的jquery插件。该jquery图片水印插件可以将图片转换为blob对象,然后为其添加自定义水印效果。 在页面中引入jquery和img2blob.js文件。 该自定义图片水印插件的默认效果和水印效果的HTML结构分别如下: 在页面DOM元素加载完毕之后,可以通过下面的方法来初始化该图片水印插件。 Img2Blob.js图片水印插件的github地址为:https://github.com/bachors/Img2Blob.js简要教程
使用方法
<script src="path/to/jquery.min.js"></script>
<script src="path/to/img2blob.js"></script>
HTML结构
<h3>默认图片</h3>
<img class="sample1" data-img2blob="img/1.png" />
<img class="sample1" data-img2blob="img/2.jpg" />
<hr>
<h3>添加水印之后的图片</h3>
<img class="sample2" data-img2blob="img/1.png" />
<img class="sample2" data-img2blob="img/2.jpg" />
初始化插件
$(function() {
// default
$(".sample1").img2blob();
// with watermark
$(".sample2").img2blob({
watermark: '@bachors',
fontStyle: 'Arial',
fontSize: '30', // px
fontColor: '#333', // default 'black'
fontX: 50, // The x coordinate where to start painting the text
fontY: 50 // The y coordinate where to start painting the text
});
});
本站资源均来自互联网,仅供研究学习,禁止违法使用和商用,产生法律纠纷本站概不负责!如果侵犯了您的权益请与我们联系!
转载请注明出处: 免费源码网-免费的源码资源网站 » jquery图片水印插件
发表评论 取消回复