Jquery切割头像
来源:互联网 发布:linux pvdispaly 编辑:程序博客网 时间:2024/05/05 00:21
jquery.imgareaselect.pack.js下载
源码如下:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>剪裁</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<script src="../Scripts/jquery-1.4.1.js" type="text/javascript"></script>路径自行更改
<script src="scripts/jquery.imgareaselect.pack.js" type="text/javascript"></script>
<style type="text/css">
em {background: url(http://static.l99.com/skin/default/images/miniblog/hover.png) no-repeat;width:180px;height:60px;position:absolute;top:-85px;left:-85px;text-align:center;padding: 10px 12px 10px;font-style:normal;z-index:2;display:none;}
em button {background-color:#CCCCCC;border:1px solid #999999;color:#000000;cursor:pointer;font-size:12px;height:20px;width:50px;}
.adelete{position:relative;}
div.imgcutDiv {margin: 30px auto;width: 320px;text-align: center;}
div.imgcutDiv a {margin:0 10px;float:left;}
</style>
</head>
<body>
<div class="tagBt_down">
<div class="con_title">
剪裁头像
</div>
<div class="con_fill">
<div class="container">
<p>
<img id="ferret" src="../Images/pic7.jpg" 路径自行更改
alt="loading IMG ......"
title="image select"
style="float: left; margin-right: 10px;"/>
</p>
</div>
<div class="clear"></div>
<div class="imgcutDiv">
<form action="cutImg.action" method="post" id="cutImgForm">
<input type="hidden" id="cutImageW" name="imgWidth" />
<input type="hidden" id="cutImageH" name="imgHeight" />
<input type="hidden" id="cutImageX" name="imgTop" />
<input type="hidden" id="cutImageY" name="imgLeft" />
<input type="hidden" value="avatars.id" name="avatarsId" />
<a id="img_cut_fb" href="javascript:void(0);" class="bt_22">确认剪裁</a>
<a href="javascript:history.go(-1);" class="bt_2">取消剪裁</a>
</form>
</div>
</div>
</div>
<script type="text/javascript">
var imageW = 537;
var imageH = 681;
function preview(img, selection) {
showCut(selection.width, selection.height, selection.x1, selection.y1);
}
function showCut(w, h, x, y) {
var scaleX = 200 / w;
var scaleY = 222 / h;
$('#ferret + div > img').css({ width: Math.round(scaleX * imageW) + 'px', height: Math.round(scaleY * imageH) + 'px', marginLeft: '-' + Math.round(scaleX * x) + 'px', marginTop: '-' + Math.round(scaleY * y) + 'px' });
$('input#cutImageW').val(w);
$('input#cutImageH').val(h);
$('input#cutImageX').val(x);
$('input#cutImageY').val(y);
}
$(document).ready(function () {
$('<div><img src="../Images/pic7.jpg" style="position: relative;" /></div>')路径自行更改
.css({ float: 'left', position: 'relative', overflow: 'hidden', width: '200px', height: '222px' })
.insertAfter($('#ferret'));
imageW = $('#ferret + div > img').width();
imageH = $('#ferret + div > img').height();
$("form > a#img_cut_fb").click(function () {
if (confirm('确任剪切吗?')) {
alert("width: " + $('input#cutImageW').val() + "height: " + $('input#cutImageH').val() + "left: " + $('input#cutImageX').val() + "top: " + $('input#cutImageY').val());
}
});
});
$(window).load(function () {
$('img#ferret').imgAreaSelect({ selectionOpacity: 0, minWidth: 90, minHeight: 100, outerOpacity: '0.5', selectionColor: 'blue', aspectRatio: '9:10', x1: 10, y1: 10, x2: 100, y2: 110, onSelectChange: preview });
showCut(90, 100, 10, 10);
});
</script>
</body>
</html>
- Jquery切割头像
- java利用jquery和smartupload实现头像上传切割效果
- 切割圆形头像
- 切割头像的小脚本
- php+javascript实现头像的切割
- jquery 头像剪切
- jquery 上传头像预览
- JQuery插件上传头像
- 数码证照中的头像自动切割原理与实现
- 仿MOP、ChinaRen、Csdn在线切割图片设置头像功能
- jquery弹窗头像选择器
- JQuery-Jcrop插件裁剪头像,及头像的上传
- jQuery拖拽效果和切割效果
- PHP和jQuery实现截图自定义头像
- 结合jquery插件实现头像裁剪
- php jquery 头像截取插件2.0
- jquery随机展示头像的实现代码
- jQuery 上传头像插件Jcrop的实例
- window的open方法和showModalDialog方法关闭时刷新父窗体
- Objective-c 命名规范
- 电话薄详细设计书
- 引伸计
- Oracle中的数据类型
- Jquery切割头像
- ext 点滴积累
- JS保留两位小数
- GTK+Visual Studio 2008环境搭建指南
- android背景选择器selector用法汇总
- final、finally和finalize的区别是什么?
- 创建动态DEEP STRUCTURE实现控制单元格可编辑,单元格颜色,行颜色
- 那不是连被狗日都不如?!
- js截取小数点后几位