日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問(wèn) 生活随笔!

生活随笔

當(dāng)前位置: 首頁(yè) > 编程资源 > 编程问答 >内容正文

编程问答

上传图片自动加水印html,html5上传多个文件并添加水印 实例源码

發(fā)布時(shí)間:2024/7/5 编程问答 35 豆豆
生活随笔 收集整理的這篇文章主要介紹了 上传图片自动加水印html,html5上传多个文件并添加水印 实例源码 小編覺(jué)得挺不錯(cuò)的,現(xiàn)在分享給大家,幫大家做個(gè)參考.

【實(shí)例簡(jiǎn)介】

【實(shí)例截圖】

【核心代碼】

html5上傳多個(gè)文件并添加水印

body{font-size:12px;}

a{text-decoration:none;}

a,a:after{-webkit-transition:all 0.3s;-moz-transition:all 0.3s;transition:all 0.3s;}

a.btn i{display:block;width:100%;height:100%;position:relative;z-index:1;cursor:pointer;}

a.btn:after,input.btn:after{content:" ";position:absolute;z-index:0;display:block;width:0;left:50%;top:0;display:block;height:100%;}

a.btn:hover:after,input.btn:hover:after{width:100%;left:0;}

a.bg40b450,.bg40b450{background:#40b450;position:relative;}

a.bg40b450:hover:after{background:#63d072;}

.pac0{filter:alpha(opacity=0);-moz-opacity:0;-khtml-opacity:0;opacity:0;}

.uploadimg span{color:#999;margin-left:15px;}

.uploadimg span i{color:#fe8625;}

.uploadimg a{width:100px;height:36px;line-height:36px;display:inline-block;position:relative;overflow:hidden;text-align:center;vertical-align:middle;}

.uploadimg a i{color:#fff;font-style:normal;}

.uploadimg a input{font-size:100px;height:130%;width:200%;position:absolute;right:0;top:0;z-index:1;}

.uploadimg p img{margin-bottom:10px;width:80px;}

#pic div{height:98px;width:98px;line-height:98px;border:1px solid #e6e6e6;text-align:center;margin-top:10px;}

#pic p{float:left;position:relative;margin:10px 10px 10px 0;width:98px;height:98px;border:1px solid #e6e6e6;}

#pic p img{margin:0;width:98px;height:98px;}

#pic p a{position:absolute;left:0;bottom:0;width:100%;height:20px;line-height:20px;background:rgba(0,0,0,0.5);color:#fff;z-index:2;}

#pic p b{background:#fe8625;color:#fff;padding:0 5px;position:absolute;left:0;top:0;display:none;}

選擇圖片

最大上傳1M的圖片(格式png,gif,jpg)

function bindclick() {

//刪除圖片事件

$("#pic a.del").unbind();

$("#pic a.del").click(function () {

$(this).parent().remove();

});

}

// 每次上傳總數(shù)

var uploadcount = 0;

$(function () {

//圖片上傳

$("#uploadfile").change(function () {

if($(this).val()!="")

upload($(this).attr("name"),1024,"Y");

});

});

//圖片上傳方法

//obj1傳上傳控件的name屬性,maxlength上傳圖片大小kb單位,watermark上傳的圖片是否加水印

function upload(obj1,maxlength,watermark,w,h) {

$("#aspnetForm").ajaxSubmit({

url: 'uploadall.ashx?index=' obj1 '&maxlength=' maxlength '&watermark=' watermark '&_=' Math.random(),

beforeSubmit: function () {

},

success: function (data) {

var imglist = data.split("|");

var imghtml = "";

var cren = "";

var hascrent = $("#pic p.crently").length > 0 ? 1 : 0;

for (var i = 0; i < imglist.length; i ) {

if (imglist[i].indexOf("Upload/Images") != -1)

imghtml = '

默認(rèn)圖刪除圖片

';

}

//上傳總數(shù)統(tǒng)計(jì)

if($("#pic p").length==0)

uploadcount = $("#pic p").length $("#uploadfile")[0].files.length;

else

uploadcount = $("#uploadfile")[0].files.length;

$("#pic").append(imghtml);

//上傳成功個(gè)數(shù)

crentcount = $("#pic p").length;

//上傳失敗個(gè)數(shù)

var failcount = uploadcount != crentcount ? "," parseInt(uploadcount - crentcount) "個(gè)文件上傳失敗" : "";

$("#filelength").html("選擇了" uploadcount "文件,成功上傳了" crentcount "文件" failcount);

bindclick();//綁定刪除事件

}

});

}

總結(jié)

以上是生活随笔為你收集整理的上传图片自动加水印html,html5上传多个文件并添加水印 实例源码的全部?jī)?nèi)容,希望文章能夠幫你解決所遇到的問(wèn)題。

如果覺(jué)得生活随笔網(wǎng)站內(nèi)容還不錯(cuò),歡迎將生活随笔推薦給好友。