-
-
Save mscottford/5015777 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<% preview_width, preview_height = proof_file.large.get_version_dimensions %> | |
<% original_width, original_height = proof_file.original.get_version_dimensions %> | |
<%= javascript_tag %Q[ | |
function activate_#{proof_file.object_id}() { | |
// set the 'master' and 'preview' images to be cropped | |
$('#cropbox').attr('src', '#{proof_file.large.url}'); | |
$('#preview').attr('src', '#{proof_file.large.url}'); | |
// update the width of the preview pane per the selected size | |
$("#preview_div").css('width', 300 * current_aspect_ratio('#{size_dom_id}')); | |
// destroy the old cropper | |
if(typeof jcrop_api != 'undefined') { | |
jcrop_api.destroy(); | |
} | |
// create a new cropper | |
var dims = new Array(); | |
dims[0] = #{original_width}; | |
dims[1] = #{original_height}; | |
var aspect_ratio = current_aspect_ratio('#{size_dom_id}'); | |
// need to set the appropriate horizontal/vertical crop option | |
if (aspect_ratio == 1) { | |
$('#vertical').attr('checked', 'checked'); | |
} else { | |
$('#horizontal').attr('checked', 'checked'); | |
} | |
current_proof_cropper = new ProofCropper(aspect_ratio, dims); | |
} | |
] %> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment