| [21] | 1 | <?php |
|---|
| 2 | require( dirname(__FILE__) . '/../../../wp-config.php' ); |
|---|
| 3 | if (!(is_user_logged_in() && current_user_can('edit_posts'))) |
|---|
| 4 | die("Athentication failed!"); |
|---|
| 5 | ?> |
|---|
| 6 | <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> |
|---|
| 7 | <html xmlns="http://www.w3.org/1999/xhtml"> |
|---|
| 8 | <head> |
|---|
| 9 | <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> |
|---|
| 10 | |
|---|
| 11 | <title> |
|---|
| 12 | <?php //bloginfo('name') ?> › |
|---|
| 13 | <?php //echo wp_specialchars( strip_tags( $title ) ); ?> |
|---|
| 14 | — WordPress |
|---|
| 15 | </title> |
|---|
| 16 | |
|---|
| 17 | <?php //wp_admin_css(); ?> |
|---|
| 18 | <link href="../../../wp-admin/wp-admin.css" rel="stylesheet" type="text/css" media="all" /> |
|---|
| 19 | |
|---|
| 20 | <script type="text/javascript" src="js/greybox.js"></script> |
|---|
| 21 | <script type="text/javascript" src="js/prototype.js"></script> |
|---|
| 22 | <script type="text/javascript" src="js/scriptaculous/scriptaculous.js"></script> |
|---|
| 23 | <script type="text/javascript" src="js/cropper.js"></script> |
|---|
| 24 | <script type="text/javascript"> |
|---|
| 25 | function MM_swapImgRestore() { //v3.0 |
|---|
| 26 | var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc; |
|---|
| 27 | } |
|---|
| 28 | |
|---|
| 29 | function MM_preloadImages() { //v3.0 |
|---|
| 30 | var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array(); |
|---|
| 31 | var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++) |
|---|
| 32 | if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}} |
|---|
| 33 | } |
|---|
| 34 | |
|---|
| 35 | function MM_findObj(n, d) { //v4.01 |
|---|
| 36 | var p,i,x; if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) { |
|---|
| 37 | d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);} |
|---|
| 38 | if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n]; |
|---|
| 39 | for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document); |
|---|
| 40 | if(!x && d.getElementById) x=d.getElementById(n); return x; |
|---|
| 41 | } |
|---|
| 42 | |
|---|
| 43 | function MM_swapImage() { //v3.0 |
|---|
| 44 | var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3) |
|---|
| 45 | if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];} |
|---|
| 46 | } |
|---|
| 47 | //--> |
|---|
| 48 | </script> |
|---|
| 49 | <script type="text/javascript" charset="utf-8"> |
|---|
| 50 | // setup the callback function |
|---|
| 51 | function onEndCrop( coords, dimensions ) { |
|---|
| 52 | $( 'x1' ).value = coords.x1; |
|---|
| 53 | $( 'y1' ).value = coords.y1; |
|---|
| 54 | $( 'x2' ).value = coords.x2; |
|---|
| 55 | $( 'y2' ).value = coords.y2; |
|---|
| 56 | $( 'width' ).value = dimensions.width; |
|---|
| 57 | $( 'height' ).value = dimensions.height; |
|---|
| 58 | } |
|---|
| 59 | |
|---|
| 60 | // basic example |
|---|
| 61 | Event.observe( |
|---|
| 62 | window, |
|---|
| 63 | 'load', |
|---|
| 64 | function() { |
|---|
| 65 | new Cropper.Img( |
|---|
| 66 | 'testImage', |
|---|
| 67 | { |
|---|
| 68 | onEndCrop: onEndCrop |
|---|
| 69 | } |
|---|
| 70 | ) |
|---|
| 71 | } |
|---|
| 72 | ); |
|---|
| 73 | |
|---|
| 74 | |
|---|
| 75 | if( typeof(dump) != 'function' ) { |
|---|
| 76 | Debug.init(true, '/'); |
|---|
| 77 | |
|---|
| 78 | function dump( msg ) { |
|---|
| 79 | Debug.raise( msg ); |
|---|
| 80 | }; |
|---|
| 81 | } else dump( '---------------------------------------\n' ); |
|---|
| 82 | </script> |
|---|
| 83 | <script type="text/javascript" charset="utf-8"> |
|---|
| 84 | |
|---|
| 85 | function imageCrop() |
|---|
| 86 | { |
|---|
| 87 | if(document.getElementById('x1').value != '0') |
|---|
| 88 | { |
|---|
| 89 | x1 = document.getElementById('x1').value; |
|---|
| 90 | y1 = document.getElementById('y1').value; |
|---|
| 91 | x2 = document.getElementById('x2').value; |
|---|
| 92 | y2 = document.getElementById('y2').value; |
|---|
| 93 | |
|---|
| 94 | w = document.getElementById('width').value; |
|---|
| 95 | h = document.getElementById('height').value; |
|---|
| 96 | |
|---|
| 97 | sourceImage = document.getElementById('sourceImage').value; |
|---|
| 98 | |
|---|
| 99 | if(sourceImage.indexOf("&sw=") != "-1") |
|---|
| 100 | { |
|---|
| 101 | // cropValue1 = document.getElementById("cropValues2").value; |
|---|
| 102 | // cropValue2 = document.getElementById("cropValues3").value; |
|---|
| 103 | cropValue3 = document.getElementById("cropValues4").value; |
|---|
| 104 | cropValue4 = document.getElementById("cropValues5").value; |
|---|
| 105 | |
|---|
| 106 | x1 = parseInt(cropValue3) + parseInt(x1); |
|---|
| 107 | y1 = parseInt(cropValue4) + parseInt(y1); |
|---|
| 108 | |
|---|
| 109 | sourceImage = sourceImage.substring(0, sourceImage.indexOf("&sw=")); |
|---|
| 110 | } |
|---|
| 111 | |
|---|
| 112 | requiredString = sourceImage+"&sw="+w+"&sh="+h+"&sx="+x1+"&sy="+y1; |
|---|
| 113 | } |
|---|
| 114 | else |
|---|
| 115 | requiredString = document.getElementById('sourceImage').value; |
|---|
| 116 | |
|---|
| 117 | window.parent.parent.document.getElementById("<?php echo $_GET["input_name"]?>").value = requiredString; |
|---|
| 118 | |
|---|
| 119 | requiredString = "<?php echo CANVASURI.'phpThumb.php?src='.CANVASURI.'files_flutter/' ?>" + requiredString; |
|---|
| 120 | |
|---|
| 121 | document.getElementById('tempSrc').value = requiredString; |
|---|
| 122 | window.parent.parent.exchangeValues(requiredString, document.getElementById('imageThumbId').value); |
|---|
| 123 | // parent.$("img_thumb_1").src = requiredString + "&w=150&h=120"; |
|---|
| 124 | window.parent.parent.$(document.getElementById('imageThumbId').value).src = requiredString + "&w=150&h=120"; |
|---|
| 125 | window.parent.parent.document.getElementById(document.getElementById('imageThumbId').value).src = requiredString + "&w=150&h=120"; |
|---|
| 126 | window.parent.parent.GB_hide(); |
|---|
| 127 | //console.log(requiredString); |
|---|
| 128 | } |
|---|
| 129 | </script> |
|---|
| 130 | <link rel="stylesheet" type="text/css" href="debug.css" media="all" /> |
|---|
| 131 | <style type="text/css"> |
|---|
| 132 | label { |
|---|
| 133 | clear: left; |
|---|
| 134 | margin-left: 50px; |
|---|
| 135 | float: left; |
|---|
| 136 | width: 5em; |
|---|
| 137 | } |
|---|
| 138 | |
|---|
| 139 | html, body { |
|---|
| 140 | margin: 0; |
|---|
| 141 | } |
|---|
| 142 | |
|---|
| 143 | #testWrap { |
|---|
| 144 | margin:8px; /* Just while testing, to make sure we return the correct positions for the image & not the window */ |
|---|
| 145 | } |
|---|
| 146 | </style> |
|---|
| 147 | </head> |
|---|
| 148 | <body onload="MM_preloadImages('./images/ajax-loader.gif')"> |
|---|
| 149 | <div align="center" id="freshpostProgressBar" name="freshpostProgressBar" style="position:absolute; bottom:50%; left:30%; z-index:0; display:inline; background:#fff; border:1px solid #666;"> |
|---|
| 150 | Loading... |
|---|
| 151 | <div><img src="./images/ajax-loader.gif" /></div> |
|---|
| 152 | </div> |
|---|
| 153 | <form name="frmCroper" action="" method="post"> |
|---|
| 154 | <?php |
|---|
| 155 | if(isset($_GET['sw'])) { |
|---|
| 156 | $finalSrc = $_GET['id']."&sw=".$_GET['sw']."&sh=".$_GET['sh']."&sx=".$_GET['sx']."&sy=".$_GET['sy']; |
|---|
| 157 | } |
|---|
| 158 | else { |
|---|
| 159 | $finalSrc = $_GET['id']; |
|---|
| 160 | } |
|---|
| 161 | if (isset($_GET['url'])) |
|---|
| 162 | $url = $_GET['url']."&post=".$_GET['post']; |
|---|
| 163 | |
|---|
| 164 | $j = 0; |
|---|
| 165 | $tmpArr = explode('&', $finalSrc); |
|---|
| 166 | $pureImage = CANVASURI.'files_flutter/'.$tmpArr[0]; |
|---|
| 167 | |
|---|
| 168 | ?> |
|---|
| 169 | <div id="testWrap" style="z-index:1;"> |
|---|
| 170 | <img src="<?php echo $pureImage; ?>" alt="test image" id="testImage" onload="javascript: document.getElementById('freshpostProgressBar').style.display = 'none';" /> |
|---|
| 171 | </div> |
|---|
| 172 | |
|---|
| 173 | <?php |
|---|
| 174 | |
|---|
| 175 | $finalSrc = $tmpArr[0]; |
|---|
| 176 | foreach(explode("&", $finalSrc) as $item) |
|---|
| 177 | { |
|---|
| 178 | if($j++ == 0) |
|---|
| 179 | continue; |
|---|
| 180 | $cropValueArr = explode("=",$item); |
|---|
| 181 | ?> |
|---|
| 182 | <input type="hidden" name="cropValues<?php echo $j; ?>" id="cropValues<?php echo $j; ?>" value="<?php echo $cropValueArr[1]; ?>" /> |
|---|
| 183 | <?php } ?> |
|---|
| 184 | |
|---|
| 185 | <input type="hidden" name="sourceImage" id="sourceImage" value="<?php echo $finalSrc; ?>" /> |
|---|
| 186 | <input type="hidden" name="url" id="url" value="<?php echo $url; ?>" /> |
|---|
| 187 | <input type="hidden" name="tempSrc" id="tempSrc" /> |
|---|
| 188 | |
|---|
| 189 | <input type="hidden" name="imageThumbId" id="imageThumbId" value="<?php echo $_GET['imageThumbId']; ?>"/> |
|---|
| 190 | |
|---|
| 191 | <p align="right" style="position:fixed; top:-10px; right:0px; z-index:1000;"> |
|---|
| 192 | <input type="button" value="Crop It" onclick="javascript: imageCrop();" /> |
|---|
| 193 | </p> |
|---|
| 194 | <input type="hidden" name="x1" id="x1" /> |
|---|
| 195 | <input type="hidden" name="y1" id="y1" /> |
|---|
| 196 | <input type="hidden" name="x2" id="x2" /> |
|---|
| 197 | <input type="hidden" name="y2" id="y2" /> |
|---|
| 198 | <input type="hidden" name="width" id="width" /> |
|---|
| 199 | <input type="hidden" name="height" id="height" /> |
|---|
| 200 | </form> |
|---|
| 201 | </body> |
|---|
| 202 | </html> |
|---|