www.gusucode.com > 仿51.com的php源码 1.1 > Photo/PhotoMagic.php
<?php include("../User/CheckLogined.php"); include("../include/dbclass.php"); $dbc=new DbConn(); $uid=$_COOKIE["uid"]; $user=$_GET["user"]; $id=$_GET["id"]; $sPhoto=$_GET["sPhoto"]; $bPhoto=$_GET["bPhoto"]; $type1=$_GET["type1"]; $type=$_GET["type"]; ?> <html xmlns:LiLi> <head> <script>//document.domain='51.com';</script> <meta http-equiv="Content-Type" content="text/html; charset=gb2312" /> <title>用户管理中心 </title> </head> <style> @media all{ LiLi\:XWindow{behavior:url(window.htc)} } .ddd{ border-top: solid black; border-right:solid black; border-bottom:solid black; border-left:solid black; border-width:1px; } </style> <script> var nowrv=""; function closewin() { if(nowrv=="") { self.returnValue=false; } else { if(nowurl!="<?php echo $bPhoto; ?>") self.returnValue=nw+"|"+nh+"|"+nx+"|"+ny; else self.returnValue=false; } } function setValue(px,py,url) { if((px+150>bigphoto.width) ||(px<0) ||(py+120>bigphoto.height) ||(py<0) ) { alert("您截取的图超过了图的范围,请放大一些,或者换个位置!") } else { window.location.href="PhotoMagicPro.php?user=<?php echo $uid; ?>&id=<?php echo $id; ?>&w="+bigphoto.width+"&h="+bigphoto.height+"&url="+url+"&x="+px+"&y="+py; nx=px; ny=py; } //self.close(); } var nx,ny; function crop(px,py,url,ok) { if((px+150>bigphoto.width) ||(px<0) ||(py+120>bigphoto.height) ||(py<0) ) { alert("您截取的图超过了图的范围,请放大一些,或者换个位置!") } else { if (ok){ nowurl=small1.src="PhotoMagicCrop.php?user=<?php echo $uid; ?>&w="+bigphoto.width+"&h="+bigphoto.height+"&url="+url+"&x="+px+"&y="+py+"&id=<?php echo $id; ?>&sdofijwner=woe98xsdf"; alert('缩略图完成!'); location.href="RedirectMagic.php"; }else nowurl=smallphoto.src="PhotoMagicCrop.php?user=<?php echo $uid; ?>&w="+bigphoto.width+"&h="+bigphoto.height+"&url="+url+"&x="+px+"&y="+py+"&id=<?php echo $id; ?>"; nx=px; ny=py; } } function showPage(u) { nowurl=u; } var nowurl="<?php echo $bPhoto; ?>"; var pw=0;ph=0; var nw,nh; function zoom(v) { if(pw==0) { pw=bigphoto.width; ph=bigphoto.height; } if(v<0){ nw=bigphoto.width=pw*Math.abs(v); nh=bigphoto.height=ph*Math.abs(v); }else { nw=bigphoto.width=pw/v; nh=bigphoto.height=ph/v; } document.all("oTempImage").width=nw; document.all("oTempImage").height=nh; } function init(){ nw=bigphoto.width; nh=bigphoto.height; document.all("zoom").disabled=false; } </script> <body scroll=no bgcolor="#ffffff" leftmargin="5" topmargin="7" onUnload="closewin()" onLoad="init();win01.show(150,120,0,0)"> <div style="display:none"><img id=small1></div> <div id="photoarea" class="ddd" style="width:100%;height:expression(document.body.clientHeight-160);overflow:scroll;"> <img id="bigphoto" style="filter:Alpha(Opacity=50,Style=0)" src="<?php echo $bPhoto; ?>"> <LiLi:XWindow id="win01" top="0" left="0" ondblclick="crop(_oWindowwin01.style.posLeft,_oWindowwin01.style.posTop,'<?php echo $bPhoto; ?>', false)"/> </div> <br> <table width="100%" height="100"> <tr> <td width="200" align="center" valign="top"><img id="smallphoto" src="<?php echo $sPhoto; ?>"></td> <td width="180" valign="top"> 图片大小:<select name="zoom" disabled onChange="zoom(this.value)"> <option value="-2.5">放大2.5倍 <option value="-2">放大2倍 <option value="-1.5">放大1.5倍 <option value="-1.4">放大1.4倍 <option value="-1.3">放大1.3倍 <option value="-1.2">放大1.2倍 <option value="-1.1">放大1.1倍 <option value="1" selected>原始尺寸 <option value="1.1">缩小1.1倍 <option value="1.2">缩小1.2倍 <option value="1.3">缩小1.3倍 <option value="1.5">缩小1.5倍 <option value="2">缩小2倍 <option value="2.5">缩小2.5倍 <option value="3">缩小3倍 <option value="3.5">缩小3.5倍 <option value="4">缩小4倍 <option value="4.5">缩小4.5倍 <option value="5">缩小5倍 </select><br><br> <input type="Button" onClick="crop(_oWindowwin01.style.posLeft,_oWindowwin01.style.posTop,'<?php echo $bPhoto; ?>',false)" value="剪 切"> <input type="Button" value="确 定" onClick="crop(_oWindowwin01.style.posLeft,_oWindowwin01.style.posTop,'<?php echo $bPhoto; ?>',true)"> <input onClick="self.close()" type="Button" value="取 消"></td> <td><table border="1" cellpadding="5"> <tr> <td style="font-size:10pt;line-height:150%">操作说明:<br>(1)用鼠标拖动红色选框,停留于需要剪切的位置后,双击选框或点击左下的“剪切”按扭即可。(若图片太大或太小,可先对图片大小进行调整)<br>(2)剪切到满意的缩图后,点击确定即可。</td> </tr> </table> </td> </tr> </table> </body> </html>