1 | <? |
---|
2 | /** |
---|
3 | * The PHP Image Editor user interface. |
---|
4 | * @author $Author: Wei Zhuo $ |
---|
5 | * @version $Id: editor.php 26 2004-03-31 02:35:21Z Wei Zhuo $ |
---|
6 | * @package ImageManager |
---|
7 | */ |
---|
8 | |
---|
9 | require_once('config.inc.php'); |
---|
10 | require_once('Classes/ImageManager.php'); |
---|
11 | require_once('Classes/ImageEditor.php'); |
---|
12 | |
---|
13 | $manager = new ImageManager($IMConfig); |
---|
14 | $editor = new ImageEditor($manager); |
---|
15 | |
---|
16 | ?> |
---|
17 | <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> |
---|
18 | |
---|
19 | <html> |
---|
20 | <head> |
---|
21 | <title></title> |
---|
22 | <script type="text/javascript"> |
---|
23 | _backend_url = "<?php print $IMConfig['backend_url']; ?>"; |
---|
24 | </script> |
---|
25 | <link href="<?php print $IMConfig['base_url'];?>assets/editor.css" rel="stylesheet" type="text/css" /> |
---|
26 | <script type="text/javascript" src="<?php print $IMConfig['base_url'];?>assets/slider.js"></script> |
---|
27 | <script type="text/javascript" src="<?php print $IMConfig['base_url'];?>assets/popup.js"></script> |
---|
28 | <script type="text/javascript"> |
---|
29 | /*<![CDATA[*/ |
---|
30 | window.resizeTo(673, 531); |
---|
31 | |
---|
32 | if(window.opener) |
---|
33 | HTMLArea = window.opener.HTMLArea; |
---|
34 | /*]]>*/ |
---|
35 | </script> |
---|
36 | <script type="text/javascript" src="<?php print $IMConfig['base_url'];?>assets/editor.js"></script> |
---|
37 | </head> |
---|
38 | |
---|
39 | <body> |
---|
40 | <div id="indicator"> |
---|
41 | <img src="<?php print $IMConfig['base_url'];?>img/spacer.gif" id="indicator_image" height="20" width="20" alt="" /> |
---|
42 | </div> |
---|
43 | <div id="tools"> |
---|
44 | <div id="tools_crop" style="display:none;"> |
---|
45 | <div id="tool_inputs"> |
---|
46 | <label for="cx">Start X:</label><input type="text" id="cx" class="textInput" onchange="updateMarker('crop')"/> |
---|
47 | <label for="cy">Start Y:</label><input type="text" id="cy" class="textInput" onchange="updateMarker('crop')"/> |
---|
48 | <label for="cw">Width:</label><input type="text" id="cw" class="textInput" onchange="updateMarker('crop')"/> |
---|
49 | <label for="ch">Height:</label><input type="text" id="ch" class="textInput" onchange="updateMarker('crop')"/> |
---|
50 | <img src="<?php print $IMConfig['base_url'];?>img/div.gif" height="30" width="2" class="div" alt="|" /> |
---|
51 | </div> |
---|
52 | <a href="javascript: editor.doSubmit('crop');" class="buttons" title="OK"><img src="<?php print $IMConfig['base_url'];?>img/btn_ok.gif" height="30" width="30" alt="OK" /></a> |
---|
53 | <a href="javascript: editor.reset();" class="buttons" title="Cancel"><img src="<?php print $IMConfig['base_url'];?>img/btn_cancel.gif" height="30" width="30" alt="Cancel" /></a> |
---|
54 | </div> |
---|
55 | <div id="tools_scale" style="display:none;"> |
---|
56 | <div id="tool_inputs"> |
---|
57 | <label for="sw">Width:</label><input type="text" id="sw" class="textInput" onchange="checkConstrains('width')"/> |
---|
58 | <a href="javascript:toggleConstraints();" title="Lock"><img src="<?php print $IMConfig['base_url'];?>img/islocked2.gif" id="scaleConstImg" height="14" width="8" alt="Lock" class="div" /></a><label for="sh">Height:</label> |
---|
59 | <input type="text" id="sh" class="textInput" onchange="checkConstrains('height')"/> |
---|
60 | <input type="checkbox" id="constProp" value="1" checked="checked" onclick="toggleConstraints()"/> |
---|
61 | <label for="constProp">Constrain Proportions</label> |
---|
62 | <img src="<?php print $IMConfig['base_url'];?>img/div.gif" height="30" width="2" class="div" alt="|" /> |
---|
63 | </div> |
---|
64 | <a href="javascript: editor.doSubmit('scale');" class="buttons" title="OK"><img src="<?php print $IMConfig['base_url'];?>img/btn_ok.gif" height="30" width="30" alt="OK" /></a> |
---|
65 | <a href="javascript: editor.reset();" class="buttons" title="Cancel"><img src="<?php print $IMConfig['base_url'];?>img/btn_cancel.gif" height="30" width="30" alt="Cancel" /></a> |
---|
66 | </div> |
---|
67 | <div id="tools_rotate" style="display:none;"> |
---|
68 | <div id="tool_inputs"> |
---|
69 | <select id="flip" name="flip" style="margin-left: 10px; vertical-align: middle;"> |
---|
70 | <option selected>Flip Image</option> |
---|
71 | <option>-----------------</option> |
---|
72 | <option value="hoz">Flip Horizontal</option> |
---|
73 | <option value="ver">Flip Vertical</option> |
---|
74 | </select> |
---|
75 | <select name="rotate" onchange="rotatePreset(this)" style="margin-left: 20px; vertical-align: middle;"> |
---|
76 | <option selected>Rotate Image</option> |
---|
77 | <option>-----------------</option> |
---|
78 | |
---|
79 | <option value="180">Rotate 180 °</option> |
---|
80 | <option value="90">Rotate 90 ° CW</option> |
---|
81 | <option value="-90">Rotate 90 ° CCW</option> |
---|
82 | </select> |
---|
83 | <label for="ra">Angle:</label><input type="text" id="ra" class="textInput" /> |
---|
84 | <img src="<?php print $IMConfig['base_url'];?>img/div.gif" height="30" width="2" class="div" alt="|" /> |
---|
85 | </div> |
---|
86 | <a href="javascript: editor.doSubmit('rotate');" class="buttons" title="OK"><img src="<?php print $IMConfig['base_url'];?>img/btn_ok.gif" height="30" width="30" alt="OK" /></a> |
---|
87 | <a href="javascript: editor.reset();" class="buttons" title="Cancel"><img src="<?php print $IMConfig['base_url'];?>img/btn_cancel.gif" height="30" width="30" alt="Cancel" /></a> |
---|
88 | </div> |
---|
89 | <div id="tools_measure" style="display:none;"> |
---|
90 | <div id="tool_inputs"> |
---|
91 | <label>X:</label><input type="text" class="measureStats" id="sx" /> |
---|
92 | <label>Y:</label><input type="text" class="measureStats" id="sy" /> |
---|
93 | <img src="<?php print $IMConfig['base_url'];?>img/div.gif" height="30" width="2" class="div" alt="|" /> |
---|
94 | <label>W:</label><input type="text" class="measureStats" id="mw" /> |
---|
95 | <label>H:</label><input type="text" class="measureStats" id="mh" /> |
---|
96 | <img src="<?php print $IMConfig['base_url'];?>img/div.gif" height="30" width="2" class="div" alt="|" /> |
---|
97 | <label>A:</label><input type="text" class="measureStats" id="ma" /> |
---|
98 | <label>D:</label><input type="text" class="measureStats" id="md" /> |
---|
99 | <img src="<?php print $IMConfig['base_url'];?>img/div.gif" height="30" width="2" class="div" alt="|" /> |
---|
100 | <button type="button" onclick="editor.reset();" >Clear</button> |
---|
101 | </div> |
---|
102 | </div> |
---|
103 | <div id="tools_save" style="display:none;"> |
---|
104 | <div id="tool_inputs"> |
---|
105 | <label for="save_filename">Filename:</label><input type="text" id="save_filename" value="<?php echo $editor->getDefaultSaveFile();?>"/> |
---|
106 | <select name="format" id="save_format" style="margin-left: 10px; vertical-align: middle;" onchange="updateFormat(this)"> |
---|
107 | <option value="" selected>Image Format</option> |
---|
108 | <option value="">---------------------</option> |
---|
109 | <option value="jpeg,85">JPEG High</option> |
---|
110 | <option value="jpeg,60">JPEG Medium</option> |
---|
111 | <option value="jpeg,35">JPEG Low</option> |
---|
112 | <option value="png">PNG</option> |
---|
113 | <?php if($editor->isGDGIFAble() != -1) { ?> |
---|
114 | <option value="gif">GIF</option> |
---|
115 | <?php } ?> |
---|
116 | </select> |
---|
117 | <label>Quality:</label> |
---|
118 | <table style="display: inline; vertical-align: middle;" cellpadding="0" cellspacing="0"> |
---|
119 | <tr> |
---|
120 | <td> |
---|
121 | <div id="slidercasing"> |
---|
122 | <div id="slidertrack" style="width:100px"><img src="<?php print $IMConfig['base_url'];?>img/spacer.gif" width="1" height="1" border="0" alt="track"></div> |
---|
123 | <div id="sliderbar" style="left:85px" onmousedown="captureStart();"><img src="<?php print $IMConfig['base_url'];?>img/spacer.gif" width="1" height="1" border="0" alt="track"></div> |
---|
124 | </div> |
---|
125 | </td> |
---|
126 | </tr> |
---|
127 | </table> |
---|
128 | <input type="text" id="quality" onchange="updateSlider(this.value)" style="width: 2em;" value="85"/> |
---|
129 | <img src="<?php print $IMConfig['base_url'];?>img/div.gif" height="30" width="2" class="div" alt="|" /> |
---|
130 | </div> |
---|
131 | <a href="javascript: editor.doSubmit('save');" class="buttons" title="OK"><img src="<?php print $IMConfig['base_url'];?>img/btn_ok.gif" height="30" width="30" alt="OK" /></a> |
---|
132 | <a href="javascript: editor.reset();" class="buttons" title="Cancel"><img src="<?php print $IMConfig['base_url'];?>img/btn_cancel.gif" height="30" width="30" alt="Cancel" /></a> |
---|
133 | </div> |
---|
134 | </div> |
---|
135 | <div id="toolbar"> |
---|
136 | <a href="javascript:toggle('crop')" id="icon_crop" title="Crop"><img src="<?php print $IMConfig['base_url'];?>img/crop.gif" height="20" width="20" alt="Crop" /><span>Crop</span></a> |
---|
137 | <a href="javascript:toggle('scale')" id="icon_scale" title="Resize"><img src="<?php print $IMConfig['base_url'];?>img/scale.gif" height="20" width="20" alt="Resize" /><span>Resize</span></a> |
---|
138 | <a href="javascript:toggle('rotate')" id="icon_rotate" title="Rotate"><img src="<?php print $IMConfig['base_url'];?>img/rotate.gif" height="20" width="20" alt="Rotate" /><span>Rotate</span></a> |
---|
139 | <a href="javascript:toggle('measure')" id="icon_measure" title="Measure"><img src="<?php print $IMConfig['base_url'];?>img/measure.gif" height="20" width="20" alt="Measure" /><span>Measure</span></a> |
---|
140 | <a href="javascript: toggleMarker();" title="Marker"><img id="markerImg" src="<?php print $IMConfig['base_url'];?>img/t_black.gif" height="20" width="20" alt="Marker" /><span>Marker</span></a> |
---|
141 | <a href="javascript:toggle('save')" id="icon_save" title="Save"><img src="<?php print $IMConfig['base_url'];?>img/save.gif" height="20" width="20" alt="Save" /><span>Save</span></a> |
---|
142 | </div> |
---|
143 | <div id="contents"> |
---|
144 | <iframe src="<?php print $IMConfig['backend_url']; ?>__function=editorFrame&img=<?php if(isset($_GET['img'])) echo rawurlencode($_GET['img']); ?>" name="editor" id="editor" scrolling="auto" title="Image Editor" frameborder="0"></iframe> |
---|
145 | </div> |
---|
146 | <div id="bottom"></div> |
---|
147 | </body> |
---|
148 | </html> |
---|