Very new to Javascript, frustrated that I cannot seem to figure this question out as I know the answer is going to be something very basic!!!
I am trying to customize JCrop which is a image cropping tool.
I want to ask users for the size of a canvas before running Jcrop so that the cropping tool runs at a fixed ratio aspect depending on their form selection
The correct format of the image ratio needs to be 1/1, 1/2, 1/3 and has been set by my form.
<select name="size" id="size">
<option value="">Please select the size of your canvass</option>
<option value="1/1">1x1</option>
<option value="1/2">1x2</option>
<option value="1/3">1x3</option>
<option value="1/4">1x4</option>
<option value="1/5">1x5</option>
<option value="1/6">1x6</option>
</select>
<script language="Javascript">
$('input[name=size]').click(function() {
MethodTwo();
});
function MethodTwo()
{
var SIZEVARIABLE = $('#size').val();
}
// initialize Jcrop
$('#preview').Jcrop({
minSize: [32, 32], // min crop size
aspectRatio : SIZEVARIABLE, // keep aspect ratio 1:1
bgFade: true, // use fade effect
bgOpacity: .3, // fade opacity
onChange: updateInfo,
onSelect: updateInfo,
onRelease: clearInfo
}, function(){
// use the Jcrop API to get the real image size
var bounds = this.getBounds();
boundx = bounds[0];
boundy = bounds[1];
// Store the Jcrop API in the jcrop_api variable
jcrop_api = this;
});
};
</script>
Thanks very much!