CropImage.php
4.45 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
<?php
define('EmpireCMSAdmin','1');
require("../../../class/connect.php");
require("../../../class/db_sql.php");
require("../../../class/functions.php");
require("../../../data/dbcache/class.php");
$link=db_connect();
$empire=new mysqlquery();
$editor=2;
//驗證用戶
$lur=is_login();
$logininid=$lur['userid'];
$loginin=$lur['username'];
$loginrnd=$lur['rnd'];
$loginlevel=$lur['groupid'];
$loginadminstyleid=$lur['adminstyleid'];
//ehash
$ecms_hashur=hReturnEcmsHashStrAll();
$enews=$_POST['enews'];
if(empty($enews))
{
$enews=$_GET['enews'];
}
if($enews)
{
hCheckEcmsRHash();
}
//裁剪圖片
if($enews=='DoCropImage')
{
if($public_r['phpmode'])
{
include("../../../class/ftp.php");
$incftp=1;
}
include('copyimgfun.php');
DoCropImage($_POST,$logininid,$loginin);
}
$fileid=(int)$_GET['fileid'];
$filepass=(int)$_GET['filepass'];
$classid=(int)$_GET['classid'];
$infoid=(int)$_GET['infoid'];
$modtype=(int)$_GET['modtype'];
if(empty($fileid))
{
printerror('NotCropImage','history.go(-1)');
}
$fstb=0;
if(empty($modtype))
{
$fstb=GetInfoTranFstb($classid,$infoid,0);
}
$filer=$empire->fetch1("select fileid,path,filename,classid,fpath,no from ".eReturnFileTable($modtype,$fstb)." where fileid='$fileid'");
if(empty($filer['fileid']))
{
printerror('NotCropImage','history.go(-1)');
}
$path=$filer['path']?$filer['path'].'/':$filer['path'];
$fspath=ReturnFileSavePath($filer['classid'],$filer['fpath']);
$big_image_name=eReturnEcmsMainPortPath().$fspath['filepath'].$path.$filer['filename'];//moreport
$imgurl=$fspath['fileurl'].$path.$filer['filename'];
if(!file_exists($big_image_name))
{
printerror('NotCropImage','history.go(-1)');
}
$filetype=GetFiletype($filer['filename']);//取得文件類型
if(!strstr($ecms_config['sets']['tranpicturetype'],','.$filetype.','))
{
printerror('CropImageFiletypeFail','history.go(-1)');
}
db_close();
$empire=null;
?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>裁剪圖片:<?=$filer['no']?> (<?=$filer['filename']?>)</title>
<link href="../../adminstyle/<?=$loginadminstyleid?>/adminstyle.css" rel="stylesheet" type="text/css">
<script src="js/jquery.min.js"></script>
<script src="js/jquery.Jcrop.js"></script>
<link rel="stylesheet" href="css/jquery.Jcrop.css" type="text/css" />
<script language="Javascript">
// Remember to invoke within jQuery(window).load(...)
// If you don't, Jcrop may not initialize properly
jQuery(document).ready(function(){
jQuery('#cropbox').Jcrop({
onChange: showCoords,
onSelect: showCoords
});
});
// Our simple event handler, called from onChange and onSelect
// event handlers, as per the Jcrop invocation above
function showCoords(c)
{
jQuery('#pic_x').val(c.x);
jQuery('#pic_y').val(c.y);
jQuery('#x2').val(c.x2);
jQuery('#y2').val(c.y2);
jQuery('#pic_w').val(c.w);
jQuery('#pic_h').val(c.h);
};
</script>
</head>
<body>
<form name="cropimgform" method="post" action="CropImage.php">
<table width="100%" border="0" align="center" cellpadding="3" cellspacing="1" class="tableborder">
<?=$ecms_hashur['form']?>
<tr>
<td height="30">裁剪圖片大小:寬
<input name="pic_w" type="text" id="pic_w" value="0" size="6">
×高 <input name="pic_h" type="text" id="pic_h" value="0" size="6">
,
<input name="doing" type="checkbox" id="doing" value="1" checked>
保留原圖 <input type="submit" name="Submit" value="裁剪圖片">
<input name="enews" type="hidden" id="enews" value="DoCropImage">
<input name="pic_x" type="hidden" id="pic_x" value="0">
<input name="pic_y" type="hidden" id="pic_y" value="0">
<input name="fileid" type="hidden" id="fileid" value="<?=$fileid?>">
<input name="filepass" type="hidden" id="filepass" value="<?=$filepass?>">
<input name="classid" type="hidden" id="classid" value="<?=$classid?>">
<input name="infoid" type="hidden" id="infoid" value="<?=$infoid?>">
<input name="modtype" type="hidden" id="modtype" value="<?=$modtype?>">
<input type="hidden" id="x2" name="x2" />
<input type="hidden" id="y2" name="y2" />
</td>
</tr>
<tr>
<td height="25" bgcolor="#FFFFFF"><img src="<?=$imgurl?>" border="0" id="cropbox"></td>
</tr>
</table>
</form>
</body>
</html>