Commit 7a7f738d by wuchengwu

人像拍摄

parent b76dfde5
var clipimg=Clipimg(document.querySelector('.dialog_clip'));
function demo_loadFile(files)
{debugger
if(files.length>0)
{
clipimg.loadFile(files[0]);
}
}
function demo_zoomIn()
{
clipimg.zoomIn();
}
function demo_zoomOut()
{
clipimg.zoomOut();
}
function demo_rotate()
{
clipimg.rotate();
}
function demo_getDataURL()
{
var url=clipimg.getDataURL(450);
document.querySelector('.dialog_clipped_img').src=url;
savePic();
}
function demo_good()
{
alert('真棒!');
}
<!DOCTYPE html>
<html>
<head lang="en">
<meta charset="UTF-8">
<meta content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0;" name="viewport" />
<title>clipimg</title>
<script type="text/javascript" src="static/rygl/js/clipimgUpload.js"></script>
<script type="text/javascript" src="static/easyui-window/js/jquery.easyui.min.js"></script>
<link rel="stylesheet" type="text/css" href="static/easyui-window/css/easyui.css">
<link rel="stylesheet" type="text/css" href="static/easyui-window/css/icon.css">
<script type="text/javascript" src="/static/js/function_tck.js"></script>
<link type="text/css" href="/static/rygl/css/catchimg.css" rel="stylesheet" />
<script LANGUAGE="javaScript">
function savePic() {
debugger;
var imgs = document.getElementById("thisimg").src;
var tishixingxi=imgs.substring(0,imgs.indexOf("data/image/png/base64/")); //提示信息
tishixingxi=imgs.substring(tishixingxi.length+"data/image/png/base64/".length,imgs.length);
var zpbw = window.parent.document.getElementById("zpbw").value;
if(zpbw==2){
window.parent.document.getElementById("imghead2").src=document.getElementById("thisimg").src;
window.parent.document.getElementById("R_ZMZP64").value=tishixingxi;
window.parent.document.getElementById("zmzpflag").value="1";
// window.parent.document.getElementById("R_ZMZP_File").value="";
}else if(zpbw==3){
window.parent.document.getElementById("imghead3").src=document.getElementById("thisimg").src;
window.parent.document.getElementById("R_CMZP64").value=tishixingxi;
window.parent.document.getElementById("cmzpflag").value="1";
// window.parent.document.getElementById("R_CMZP_File").value="";
}else if(zpbw==4){
window.parent.document.getElementById("imghead4").src=document.getElementById("thisimg").src;
window.parent.document.getElementById("R_YCMZP64").value=tishixingxi;
window.parent.document.getElementById("ycmzpflag").value="1";
// window.parent.document.getElementById("R_YCMZP_File").value="";
}else if(zpbw==31){
window.parent.document.getElementById("imghead31").src=document.getElementById("thisimg").src;
window.parent.document.getElementById("tstz1Base64").value=tishixingxi;
window.parent.document.getElementById("tstzflag1").value="0";
}else if(zpbw==32){
window.parent.document.getElementById("imghead32").src=document.getElementById("thisimg").src;
window.parent.document.getElementById("tstz2Base64").value=tishixingxi;
window.parent.document.getElementById("tstzflag2").value="0";
}
}
function cjwc() {
window.parent.jtwc();
}
</script>
</head>
<body>
<div id="jt" class="dialog" style="height: 100%;width: 100%;">
<div class="dialog_mask"></div>
<div class="dialog_wrap" style="height: 100%;width: 100%;margin-top: 0px;">
<div class="dialog_container_clip" style="height: 100%;width: 100%;margin-top: 0px;">
<div style="height: 100%;width: 49%;float: left;margin-top: 50px;">
<div class="dialog_center_div">
<div class="dialog_clip"></div><!-- 这里放置图片 -->
</div>
<div class="dialog_center_div dialog_buttons">
<input id="dialog_picture" onchange="demo_loadFile(this.files)" type="file" style="position:absolute; z-index: -1; visibility: hidden;" accept="image/*" />
<label for="dialog_picture" class="dialog_button">上传</label><!-- 这个label对应上面的input,这是为了不显示input的文件名和按钮 -->
<div id="dialog_ok" onclick="demo_getDataURL()" class="dialog_button">截取</div>
<div onclick="cjwc()" class="dialog_button">完成</div>
</div>
<div class="dialog_center_div dialog_buttons">
<div id="dialog_zoomIn" onclick="demo_zoomIn()" class="dialog_button">放大</div>
<div id="dialog_zoomOut" onclick="demo_zoomOut()" class="dialog_button">缩小</div>
<div id="dialog_rotate" onclick="demo_rotate()" class="dialog_button">旋转</div>
</div>
</div>
<div style="height: 100%;width: 49%;float: right;margin-top: 0px;">
<div class="dialog_center_div">
<img id="thisimg" class="dialog_clipped_img" src=""/><!-- 这里放置截图后图片 -->
</div>
</div>
</div>
</div>
</div>
<canvas width="900" height="1200" style="width: 450px;height: 600px;" id="canvas" ></canvas>
<script type="text/javascript" src="static/rygl/js/catchimgUpload.js"></script>
</body>
</html>
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment