| 1 | <?php |
|---|
| 2 | |
|---|
| 3 | |
|---|
| 4 | |
|---|
| 5 | |
|---|
| 6 | |
|---|
| 7 | |
|---|
| 8 | |
|---|
| 9 | |
|---|
| 10 | |
|---|
| 11 | if(isset($_REQUEST['mode'])) $insertMode=$_REQUEST['mode']; |
|---|
| 12 | if(!isset($insertMode)) $insertMode="image"; |
|---|
| 13 | |
|---|
| 14 | require_once('config.inc.php'); |
|---|
| 15 | require_once('Classes/ExtendedFileManager.php'); |
|---|
| 16 | require_once('../ImageManager/Classes/ImageEditor.php'); |
|---|
| 17 | |
|---|
| 18 | $manager = new ExtendedFileManager($IMConfig,$insertMode); |
|---|
| 19 | $editor = new ImageEditor($manager); |
|---|
| 20 | |
|---|
| 21 | ?> |
|---|
| 22 | <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> |
|---|
| 23 | |
|---|
| 24 | <html> |
|---|
| 25 | <head> |
|---|
| 26 | <title>Xinha Image Editor</title> |
|---|
| 27 | <link href="<?php print $IMConfig['base_url'];?>assets/editor.css" rel="stylesheet" type="text/css" /> |
|---|
| 28 | <script type="text/javascript" src="<?php print $IMConfig['base_url'];?>assets/slider.js"></script> |
|---|
| 29 | <script type="text/javascript" src="../../popups/popup.js"></script> |
|---|
| 30 | <script type="text/javascript" src="<?php print $IMConfig['base_url'];?>assets/popup.js"></script> |
|---|
| 31 | <script type="text/javascript"> |
|---|
| 32 | /*<![CDATA[*/ |
|---|
| 33 | |
|---|
| 34 | var _backend_url = "<?php print $IMConfig['backend_url']."&mode=$insertMode"; ?>&"; |
|---|
| 35 | |
|---|
| 36 | if(window.opener) |
|---|
| 37 | Xinha = window.opener.Xinha; |
|---|
| 38 | /*]]>*/ |
|---|
| 39 | </script> |
|---|
| 40 | <script type="text/javascript" src="<?php print $IMConfig['base_url'];?>assets/editor.js"></script> |
|---|
| 41 | </head> |
|---|
| 42 | |
|---|
| 43 | <body> |
|---|
| 44 | <table style="width:100%"> |
|---|
| 45 | <tr> |
|---|
| 46 | <td id="indicator"> |
|---|
| 47 | <img src="<?php print $IMConfig['base_url'];?>img/spacer.gif" id="indicator_image" height="20" width="20" alt=""/> |
|---|
| 48 | </td> |
|---|
| 49 | <td id="tools"> |
|---|
| 50 | <div id="tools_crop" style="display:none;"> |
|---|
| 51 | <div class="tool_inputs"> |
|---|
| 52 | <label for="cx">Start X:</label><input type="text" id="cx" class="textInput" onchange="updateMarker('crop')"/> |
|---|
| 53 | <label for="cy">Start Y:</label><input type="text" id="cy" class="textInput" onchange="updateMarker('crop')"/> |
|---|
| 54 | <label for="cw">Width:</label><input type="text" id="cw" class="textInput" onchange="updateMarker('crop')"/> |
|---|
| 55 | <label for="ch">Height:</label><input type="text" id="ch" class="textInput" onchange="updateMarker('crop')"/> <img src="<?php print $IMConfig['base_url'];?>img/div.gif" height="30" width="2" class="div" alt="|" /> |
|---|
| 56 | </div> |
|---|
| 57 | <a href="javascript:void(0);" onclick="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> |
|---|
| 58 | <a href="javascript:void(0);" onclick="editor.reset();" class="buttons" title="Cancel"><img src="<?php print $IMConfig['base_url'];?>img/btn_cancel.gif" height="30" width="30" alt="Cancel" /></a> |
|---|
| 59 | </div> |
|---|
| 60 | <div id="tools_scale" style="display:none;"> |
|---|
| 61 | <div class="tool_inputs"> |
|---|
| 62 | <label for="sw">Width:</label><input type="text" id="sw" class="textInput" onchange="checkConstrains('width')"/> |
|---|
| 63 | <a href="javascript:void(0);" onclick="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> |
|---|
| 64 | <input type="text" id="sh" class="textInput" onchange="checkConstrains('height')"/> |
|---|
| 65 | <input type="checkbox" id="constProp" value="1" checked="checked" onclick="toggleConstraints()"/> |
|---|
| 66 | <label for="constProp">Constrain Proportions</label> |
|---|
| 67 | <img src="<?php print $IMConfig['base_url'];?>img/div.gif" height="30" width="2" class="div" alt="|" /> |
|---|
| 68 | </div> |
|---|
| 69 | <a href="javascript:void(0);" onclick="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> |
|---|
| 70 | <a href="javascript:void(0);" onclick="zoom();" class="buttons" title="Cancel"><img src="<?php print $IMConfig['base_url'];?>img/btn_cancel.gif" height="30" width="30" alt="Cancel" /></a> |
|---|
| 71 | </div> |
|---|
| 72 | <div id="tools_rotate" style="display:none;"> |
|---|
| 73 | <div class="tool_inputs"> |
|---|
| 74 | <select id="rotate_sub_action" name="rotate_sub_action" onchange="rotateSubActionSelect(this)" style="margin-left: 10px; vertical-align: middle;"> |
|---|
| 75 | <option selected="selected" value="rotate">Rotate Image</option> |
|---|
| 76 | <option value="flip">Flip Image</option> |
|---|
| 77 | </select> |
|---|
| 78 | <select id="rotate_preset_select" name="rotate_preset_select" onchange="rotatePreset(this)" style="margin-left: 20px; vertical-align: middle;"> |
|---|
| 79 | <option>Preset</option> |
|---|
| 80 | <option value="180">Rotate 180 °</option> |
|---|
| 81 | <option value="90">Rotate 90 ° CW</option> |
|---|
| 82 | <option value="-90">Rotate 90 ° CCW</option> |
|---|
| 83 | </select> |
|---|
| 84 | <select id="flip" name="flip" style="margin-left: 20px; vertical-align: middle;display:none"> |
|---|
| 85 | <option value="hoz">Flip Horizontal</option> |
|---|
| 86 | <option value="ver">Flip Vertical</option> |
|---|
| 87 | </select> |
|---|
| 88 | <label for="ra">Angle:<input type="text" id="ra" class="textInput" /></label> |
|---|
| 89 | <img src="<?php print $IMConfig['base_url'];?>img/div.gif" height="30" width="2" class="div" alt="|" /> |
|---|
| 90 | </div> |
|---|
| 91 | <a href="javascript:void(0);" onclick="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> |
|---|
| 92 | <a href="javascript:void(0);" onclick="editor.reset();" class="buttons" title="Cancel"><img src="<?php print $IMConfig['base_url'];?>img/btn_cancel.gif" height="30" width="30" alt="Cancel" /></a> |
|---|
| 93 | </div> |
|---|
| 94 | <div id="tools_measure" style="display:none;"> |
|---|
| 95 | <div class="tool_inputs"> |
|---|
| 96 | <label>X:</label><input type="text" class="measureStats" id="sx" /> |
|---|
| 97 | <label>Y:</label><input type="text" class="measureStats" id="sy" /> |
|---|
| 98 | <img src="<?php print $IMConfig['base_url'];?>img/div.gif" height="30" width="2" class="div" alt="|" /> |
|---|
| 99 | <label>W:</label><input type="text" class="measureStats" id="mw" /> |
|---|
| 100 | <label>H:</label><input type="text" class="measureStats" id="mh" /> |
|---|
| 101 | <img src="<?php print $IMConfig['base_url'];?>img/div.gif" height="30" width="2" class="div" alt="|" /> |
|---|
| 102 | <label>A:</label><input type="text" class="measureStats" id="ma" /> |
|---|
| 103 | <label>D:</label><input type="text" class="measureStats" id="md" /> |
|---|
| 104 | <img src="<?php print $IMConfig['base_url'];?>img/div.gif" height="30" width="2" class="div" alt="|" /> |
|---|
| 105 | <button type="button" onclick="editor.reset();" >Clear</button> |
|---|
| 106 | </div> |
|---|
| 107 | </div> |
|---|
| 108 | <div id="tools_save" style="display:none;"> |
|---|
| 109 | <div class="tool_inputs"> |
|---|
| 110 | <label for="save_filename">Filename:</label><input type="text" id="save_filename" value="<?php echo $editor->getDefaultSaveFile();?>"/> |
|---|
| 111 | <select name="format" id="save_format" style="margin-left: 10px; vertical-align: middle;" onchange="updateFormat(this)"> |
|---|
| 112 | <option value="jpeg,85">JPEG High</option> |
|---|
| 113 | <option value="jpeg,60">JPEG Medium</option> |
|---|
| 114 | <option value="jpeg,35">JPEG Low</option> |
|---|
| 115 | <option value="png">PNG</option> |
|---|
| 116 | <?php if($editor->isGDGIFAble() != -1) { ?> |
|---|
| 117 | <option value="gif">GIF</option> |
|---|
| 118 | <?php } ?> |
|---|
| 119 | </select> |
|---|
| 120 | <div id="slider" style="display:inline"> |
|---|
| 121 | <label>Quality:</label> |
|---|
| 122 | <table style="display: inline; vertical-align: middle;" cellpadding="0" cellspacing="0"> |
|---|
| 123 | <tr> |
|---|
| 124 | <td> |
|---|
| 125 | <div id="slidercasing"> |
|---|
| 126 | <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> |
|---|
| 127 | <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> |
|---|
| 128 | </div> |
|---|
| 129 | </td> |
|---|
| 130 | </tr> |
|---|
| 131 | </table> |
|---|
| 132 | <input type="text" id="quality" onchange="updateSlider(this.value)" style="width: 2em;" value="85"/> |
|---|
| 133 | </div> |
|---|
| 134 | <img src="<?php print $IMConfig['base_url'];?>img/div.gif" height="30" width="2" class="div" alt="|" /> |
|---|
| 135 | <div style="display:inline;font-size:10px"> |
|---|
| 136 | <span>Filesize:</span> <span id="filesize"></span> |
|---|
| 137 | </div> |
|---|
| 138 | <img src="<?php print $IMConfig['base_url'];?>img/div.gif" height="30" width="2" class="div" alt="|" /> |
|---|
| 139 | </div> |
|---|
| 140 | <button type="button" style="float:left;margin:17px 5px 0 ;" onclick="editor.doSubmit('preview')">Preview</button> |
|---|
| 141 | <button type="button" style="float:left;margin-top:17px;" onclick="editor.doSubmit('save');">Save</button> |
|---|
| 142 | </div> |
|---|
| 143 | </td> |
|---|
| 144 | </tr> |
|---|
| 145 | <tr> |
|---|
| 146 | <td id="toolbar"> |
|---|
| 147 | <a href="javascript:void(0);" onclick="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> |
|---|
| 148 | <a href="javascript:void(0);" onclick="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> |
|---|
| 149 | <a href="javascript:void(0);" onclick="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> |
|---|
| 150 | <a href="javascript:void(0);" onclick="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> |
|---|
| 151 | <a href="javascript:void(0);" onclick="toggleMarker();" title="Toggle marker color"><img id="markerImg" src="<?php print $IMConfig['base_url'];?>img/t_black.gif" height="20" width="20" alt="Marker" /><span>Marker</span></a> |
|---|
| 152 | <a href="javascript:void(0);" onclick="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> |
|---|
| 153 | <div style="margin-top:10px">Zoom</div> |
|---|
| 154 | <select id="zoom" onchange="zoom(this.value)"> |
|---|
| 155 | <option value="10">10%</option> |
|---|
| 156 | <option value="25">25%</option> |
|---|
| 157 | <option value="50">50%</option> |
|---|
| 158 | <option value="75">75%</option> |
|---|
| 159 | <option value="100" selected="selected">100%</option> |
|---|
| 160 | <option value="200">200%</option> |
|---|
| 161 | </select> |
|---|
| 162 | </td> |
|---|
| 163 | <td id="contents"> |
|---|
| 164 | <?php |
|---|
| 165 | $iframe_src = $IMConfig['backend_url'].'__function=editorFrame&img='.((isset($_GET['img'])) ? rawurlencode($_GET['img']) : '').'&mode='. $insertMode; |
|---|
| 166 | ?> |
|---|
| 167 | <iframe src="<?php print htmlspecialchars($iframe_src) ?>" name="editor" id="editor" scrolling="auto" title="Image Editor" frameborder="0"></iframe> |
|---|
| 168 | </td> |
|---|
| 169 | </tr> |
|---|
| 170 | </table> |
|---|
| 171 | </body> |
|---|
| 172 | </html> |
|---|