| 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 | $imageInfo = $editor->processImage(); |
|---|
| 21 | |
|---|
| 22 | ?> |
|---|
| 23 | |
|---|
| 24 | <html> |
|---|
| 25 | <head> |
|---|
| 26 | <title></title> |
|---|
| 27 | <link href="<?php print $IMConfig['base_url'];?>assets/editorFrame.css" rel="stylesheet" type="text/css" /> |
|---|
| 28 | <script type="text/javascript" src="<?php print $IMConfig['base_url'];?>assets/wz_jsgraphics.js"></script> |
|---|
| 29 | <script type="text/javascript" src="<?php print $IMConfig['base_url'];?>assets/EditorContent.js"></script> |
|---|
| 30 | <script type="text/javascript"> |
|---|
| 31 | var _backend_url = "<?php print $IMConfig['backend_url']."&mode=$insertMode"; ?>&"; |
|---|
| 32 | |
|---|
| 33 | if(window.top) |
|---|
| 34 | Xinha = window.top.Xinha; |
|---|
| 35 | |
|---|
| 36 | function i18n(str) { |
|---|
| 37 | return Xinha._lc(str, 'ImageManager'); |
|---|
| 38 | } |
|---|
| 39 | |
|---|
| 40 | var mode = "<?php echo $editor->getAction(); ?>" //crop, scale, measure |
|---|
| 41 | var currentImageFile = "<?php if(count($imageInfo)>0) echo rawurlencode($imageInfo['file']); ?>"; |
|---|
| 42 | var fileSize = "<?php echo (round($imageInfo['filesize'] / 1024,1)).' KB' ?>"; |
|---|
| 43 | |
|---|
| 44 | |
|---|
| 45 | <?php if ($editor->isFileSaved() == 1) { ?> |
|---|
| 46 | alert(i18n('File saved.')); |
|---|
| 47 | |
|---|
| 48 | window.parent.opener.parent.refresh(); |
|---|
| 49 | window.parent.opener.selectImage |
|---|
| 50 | ( |
|---|
| 51 | '<?php echo $imageInfo['saveFile'] ?>', |
|---|
| 52 | '<?php echo $imageInfo['saveFile'] ?>'.replace(/^.*\/?([^\/]*)$/, '$1'), |
|---|
| 53 | <?php echo $imageInfo['width'] ?>, |
|---|
| 54 | <?php echo $imageInfo['height'] ?> |
|---|
| 55 | ); |
|---|
| 56 | window.parent.close(); |
|---|
| 57 | |
|---|
| 58 | <?php } else if ($editor->isFileSaved() == -1) { ?> |
|---|
| 59 | alert(i18n('File was not saved.')); |
|---|
| 60 | <?php } ?> |
|---|
| 61 | |
|---|
| 62 | </script> |
|---|
| 63 | <script type="text/javascript" src="<?php print $IMConfig['base_url'];?>assets/editorFrame.js"></script> |
|---|
| 64 | </head> |
|---|
| 65 | |
|---|
| 66 | <body> |
|---|
| 67 | <div id="status"></div> |
|---|
| 68 | <div id="ant" class="selection" style="visibility:hidden"><img src="<?php print $IMConfig['base_url'];?>img/spacer.gif" width="0" height="0" border="0" alt="" id="cropContent"></div> |
|---|
| 69 | <?php if ($editor->isGDEditable() == -1) { ?> |
|---|
| 70 | <div style="text-align:center; padding:10px;"><span class="error">GIF format is not supported, image editing not supported.</span></div> |
|---|
| 71 | <?php } ?> |
|---|
| 72 | <table height="100%" width="100%"> |
|---|
| 73 | <tr> |
|---|
| 74 | <td> |
|---|
| 75 | <?php if(count($imageInfo) > 0 && is_file($imageInfo['fullpath'])) { ?> |
|---|
| 76 | <span id="imgCanvas" class="crop"><img src="<?php echo $imageInfo['src']; ?>" <?php echo $imageInfo['dimensions']; ?> alt="" id="theImage" name="theImage"></span> |
|---|
| 77 | <?php } else { ?> |
|---|
| 78 | <span class="error">No Image Available</span> |
|---|
| 79 | <?php } ?> |
|---|
| 80 | </td> |
|---|
| 81 | </tr> |
|---|
| 82 | </table> |
|---|
| 83 | </body> |
|---|
| 84 | </html> |
|---|