Adjusting coordinates for the original resolution can also be done in the backend rather than in the javascript on the front-end. Which is particularly useful if you have your JS in an external CoffeeScript file and not in the view. To do so, modify your crop_command in cropper.rb processor:
ruby
modulePaperclipclassCropper < Thumbnail
...
defcrop_command
target = @attachment.instance
if target.cropping?
ratio = target.photo_geometry(:original).width / target.photo_geometry(:large).width
["-crop", "#{(target.crop_w.to_i*ratio).round}x#{(target.crop_h.to_i*ratio).round}+#{(target.crop_x.to_i*ratio).round}+#{(target.crop_y.to_i*ratio).round}"]
endendendend
Adjusting coordinates for the original resolution can also be done in the backend rather than in the javascript on the front-end. Which is particularly useful if you have your JS in an external CoffeeScript file and not in the view. To do so, modify your
crop_command
in cropper.rb processor: