123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153 |
- <!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>
- <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
- <base target="_self" />
- <title>图片切割系统</title>
- <script type="text/javascript">
- var isIE = (document.all) ? true : false;
- var isIE6 = isIE && ([/MSIE (\d)\.0/i.exec(navigator.userAgent)][0][1] == 6);
- var $ = function (id) {
- return "string" == typeof id ? document.getElementById(id) : id;
- };
- var Class = {
- create: function() {
- return function() { this.initialize.apply(this, arguments); }
- }
- }
- var Extend = function(destination, source) {
- for (var property in source) {
- destination[property] = source[property];
- }
- }
- var Bind = function(object, fun) {
- return function() {
- return fun.apply(object, arguments);
- }
- }
- var BindAsEventListener = function(object, fun) {
- var args = Array.prototype.slice.call(arguments).slice(2);
- return function(event) {
- return fun.apply(object, [event || window.event].concat(args));
- }
- }
- var CurrentStyle = function(element){
- return element.currentStyle || document.defaultView.getComputedStyle(element, null);
- }
- function addEventHandler(oTarget, sEventType, fnHandler) {
- if (oTarget.addEventListener) {
- oTarget.addEventListener(sEventType, fnHandler, false);
- } else if (oTarget.attachEvent) {
- oTarget.attachEvent("on" + sEventType, fnHandler);
- } else {
- oTarget["on" + sEventType] = fnHandler;
- }
- };
- function removeEventHandler(oTarget, sEventType, fnHandler) {
- if (oTarget.removeEventListener) {
- oTarget.removeEventListener(sEventType, fnHandler, false);
- } else if (oTarget.detachEvent) {
- oTarget.detachEvent("on" + sEventType, fnHandler);
- } else {
- oTarget["on" + sEventType] = null;
- }
- };
- </script>
- <script type="text/javascript" src="ImgCropper.js"></script>
- <script type="text/javascript" src="Drag.js"></script>
- <script type="text/javascript" src="Resize.js"></script>
- <style type="text/css">
- #rRightDown,#rLeftDown,#rLeftUp,#rRightUp,#rRight,#rLeft,#rUp,#rDown{
- position:absolute;
- background:#FFF;
- border: 1px solid #333;
- width: 6px;
- height: 6px;
- z-index:500;
- font-size:0;
- opacity: 0.5;
- filter:alpha(opacity=50);
- }
- #rLeftDown,#rRightUp{cursor:ne-resize;}
- #rRightDown,#rLeftUp{cursor:nw-resize;}
- #rRight,#rLeft{cursor:e-resize;}
- #rUp,#rDown{cursor:n-resize;}
- #rLeftDown{left:0px;bottom:0px;}
- #rRightUp{right:0px;top:0px;}
- #rRightDown{right:0px;bottom:0px;background-color:#00F;}
- #rLeftUp{left:0px;top:0px;}
- #rRight{right:0px;top:50%;margin-top:-4px;}
- #rLeft{left:0px;top:50%;margin-top:-4px;}
- #rUp{top:0px;left:50%;margin-left:-4px;}
- #rDown{bottom:0px;left:50%;margin-left:-4px;}
- #bgDiv{width:368px; height:265px; border:1px solid #666666; position:relative;}
- #dragDiv{border:1px dashed #fff; width:100px; height:60px; top:50px; left:50px; cursor:move; }
- body{margin:10px}
- </style>
- </head>
- <body>
- <table width="750" border="0" cellspacing="0" cellpadding="0">
- <tr>
- <td width="368"><div id="bgDiv">
- <div id="dragDiv">
- <div id="rRightDown"> </div>
- <div id="rLeftDown"> </div>
- <div id="rRightUp"> </div>
- <div id="rLeftUp"> </div>
- <div id="rRight"> </div>
- <div id="rLeft"> </div>
- <div id="rUp"> </div>
- <div id="rDown"></div>
- </div>
- </div></td>
- <td align="center"><div id="viewDiv" style="width:368px; height:265px;"> </div></td>
- </tr>
- </table>
- <br />
- <input name="" type="button" value="生成图片" onclick="Create()" />
- <br /><br />
- <img id="imgCreat" style="display:none;" />
- <script>
- var ic = new ImgCropper("bgDiv", "dragDiv", "<%=Request.QueryString("imgurl")%>", {
- Width: 368, Height: 265, Color: "#000",
- Resize: true,Scale:true,Ratio:368/265,
- Right: "rRight", Left: "rLeft", Up: "rUp", Down: "rDown",
- RightDown: "rRightDown", LeftDown: "rLeftDown", RightUp: "rRightUp", LeftUp: "rLeftUp",
- Preview: "viewDiv", viewWidth: 368, viewHeight: 265
- })
- function Create(){
- var p = ic.Url, o = ic.GetPos();
- x = o.Left,
- y = o.Top,
- w = o.Width,
- h = o.Height,
- pw = ic._layBase.width,
- ph = ic._layBase.height;
-
- //$("imgCreat").onload = function(){ this.style.display = ""; }
- //$("imgCreat").src = "ImgCropper1.asp?p=" + p + "&x=" + x + "&y=" + y + "&w=" + w + "&h=" + h + "&pw=" + pw + "&ph=" + ph + "&" + Math.random();
- //alert(p + "&x=" + x + "&y=" + y + "&w=" + w + "&h=" + h + "&pw=" + pw + "&ph=" + ph)
- document.location.replace("ImgCropper1.asp?p=" + p + "&x=" + x + "&y=" + y + "&w=" + w + "&h=" + h + "&pw=" + pw + "&ph=" + ph + "&" + Math.random());
- }
- </script>
- </body>
- </html>
|