您好,欢迎来到三六零分类信息网!老站,搜索引擎当天收录,欢迎发信息

jquery图片水印插件

2025/8/4 0:03:51发布25次查看
简要教程
img2blob.js是一款可以为图片添加自定义水印的jquery插件。该jquery图片水印插件可以将图片转换为blob对象,然后为其添加自定义水印效果。
使用方法
在页面中引入jquery和img2blob.js文件。
<script src="path/to/jquery.min.js"></script> <script src="path/to/img2blob.js"></script>
html结构
该自定义图片水印插件的默认效果和水印效果的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" />
初始化插件
在页面dom元素加载完毕之后,可以通过下面的方法来初始化该图片水印插件
$(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 }); });
img2blob.js图片水印插件的github地址为:https://github.com/bachors/img2blob.js
以上就是jquery图片水印插件的内容。
该用户其它信息

VIP推荐

免费发布信息,免费发布B2B信息网站平台 - 三六零分类信息网 沪ICP备09012988号-2
企业名录 Product