<?
$tw=$_GET["tw"];
$th=$_GET["th"];
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html>
<head>
<link rel="stylesheet" type="text/css" media="screen" href="css/uvumi-crop.css"/>
<script type="text/javascript" src="js/mootools-for-crop.js"> </script>
<script type="text/javascript" src="js/UvumiCrop-compressed.js"> </script> 
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<script type="text/javascript" >
new uvumiCropper('myImage',{
keepRatio:true,
	mini:{
x: <?=$tw?>,y:<?=$th?>
},
onComplete:function(top,left,width,height){
$('input_top').set('value', top);
$('input_left').set('value', left);
$('input_width').set('value', width);
$('input_height').set('value', height);
},
preview:true,
coordinatesOpacity:1
});

//window.addEvent('domready',function(){
//$('myForm').addEvent('submit',function(event){
//event.stop();
//myCropper.cropSave();
//});
//});
</script>
</head>
<body>
<div>
<img id="myImage" width="" src="../../datacenter/upload/<?=$_GET["file"]?>" alt="My image" />
</div>
<form  id="myForm" name="myform" action="gd-lib.php" method="post">
<input id="input_top" name="top" type="hidden" readonly="readonly"/>
<input id="input_left" name="left" type="hidden" readonly="readonly"/>
<input id="input_width" name="width" type="hidden" readonly="readonly"/>
<input id="input_height" name="height" type="hidden" readonly="readonly"/>
<input id="input_height" name="max_height" type="hidden" value="363"/>
<input id="input_width" name="max_width" type="hidden" value="605"/>
<input name="filename" value="<?=$_GET["file"]?>" type="hidden" />
<p align="center"><input type="submit" name="submit" value="บันทึกรูปภาพนี้" onclick="javascript:return confirm('ท่านแน่ใจนะว่าจะครอปรูปภาพนี้?')">
</p>
</form>
</body>
</html>