Fengyuan Chen's terrific Cropper jQuery plugin for cropping/zooming/rotating/exporting images, packaged for Meteor
With the release of Meteor 1.3 and its direct support for npm, there's no longer a need for wrapper Atmosphere packages like this one — just run meteor npm install --save cropper
to install Cropper directly and import it into your file(s). This package will remain on Atmosphere for the time being for legacy projects, but it won't be updated to newer versions of Cropper.
meteor add jonblum:jquery-cropper
http://fengyuanchen.github.io/cropper/
Full changelogs are here.
The following options were renamed:
touchDragZoom
tozoomOnTouch
mouseWheelZoom
tozoomOnWheel
doubleClickToggle
totoggleDragModeOnDblclick
checkImageOrigin
tocheckCrossOrigin
The strict
and dragCrop
options were removed. The same functionality can be obtained with viewMode: 1
and dragMode: crop
, respectively.
None
The dragstart
, dragmove
, and dragend
events were renamed to cropstart
, cropmove
, and cropend
, respectively.
The zoomin
and zoomout
events were merged to a single zoom
event.
The crop
option and change
event were merged intoa single crop
event.
The resizable
option was renamed to cropBoxResizable
.
The getDataURL
method was removed. See more below.
Yeah, 0.9.0 removed the getDataURL
method that you were probably using and replaced it with getCroppedCanvas
, which returns a canvas object upon which you can then call toDataURL
or toBlob
. One benefit of this more flexible approach is that you now don't need to construct a new canvas if, say, you want to scale an image after the user crops it. See the docs for more details.
I'm instantiating Cropper on the fly (say, in a Bootstrap modal's show event), but it doesn't seem to 'pick up' the image I've set dynamically.
In the meantime, you can get around this by explictly setting the image's source before loading the cropper:
$('.img-to-crop').attr('src',Session.get('myImg'));
$('.img-to-crop').cropper({ ...