I searched for this for a while, While I got another great plugin - JWindowCrop
You can also get the plugin from the repository .
Favorably, the plugin is quite simple, and you can easily change it to suit your needs.
Here's how I did it to fit the cropping area of ββthe facebook cover:
HTML:
<img id="target" class="crop" alt="" src="images/sample-cover.jpg" />
JavaScript:
$('.crop').jWindowCrop({ targetWidth: 851, //Width of facebook cover division targetHeight: 315, //Height of cover division loadingText: 'Your Cover is uploading....', onChange: function(result) { console.log("separation from left- "+result.cropX); console.log("separation from top- "+result.cropY); console.log("width- "+result.cropW); console.log("Height- "+result.cropH); } });
You can change the inner area if you are not satisfied with the plugin.
NOTE Since the facebook cover is only 851px wide, the uploaded image and the crop split should have the same width ie 851px.
I prepared a demo here
EDIT: Just in case, if you notice the text βDrag and Drop to Moveβ in the cropping area (upper left side), when you drag the image inside the cover, you can specify your own text by changing this plugin line:
Line:34- base.$frame.append('<div class="jwc_controls" style="position:relative;display:'+(base.options.showControlsOnStart ? 'block' : 'none')+';"><span class="dragger">Drag to reposition</span></div>');
I could not manage to add a parameter to the plugin to do this.
ashutosh
source share