Crop Thumbnail

Crop the image by clicking and dragging the mouse over the image.
Pressing "Save Thumbnail" will crop the thumbnail and set it as the new thumbnail for this page.
<%= cropper_image_tag({ :url => File.join('content', @pg.path, @image_file) }) %>

<%= form_remote_tag :update => 'select_thumbnail_dialog_content', :url => { :action => "save_crop_thumb", :id => @pg, :filename => @image_file } do -%>
Adjust Crop: <%= text_field :selection, :x2, :size => 3, :onkeyup => "resizeCropper();" %> x <%= text_field :selection, :y2, :size => 3, :onkeyup => "resizeCropper();" %>
Output Image Dimensions <%- if defined?(CmsThumbnailCropPresets) -%>
Presets:
<%- CmsThumbnailCropPresets.each do |name, dimensions| -%>
<%- end -%>
<%- end -%> <%= text_field :image, :max_width, :size => 3, :value => @width, :onchange => "deselectAllPresets(); recalculateHeight();" %> x <%= text_field :image, :max_height, :size => 3, :value => @height, :onchange => "deselectAllPresets(); recalculateWidth();" %> <%= javascript_tag "$('image_max_width').onkeydown = disableEnterKey; $('image_max_height').onkeydown = disableEnterKey;" %> <%= image_tag('management/icon_unlocked.png', :id => 'icon_unlocked', :onclick => "deselectAllPresets(); lockImageSize();") %> <%= image_tag('management/icon_locked.png', :id => 'icon_locked', :onclick => "deselectAllPresets(); unlockImageSize();", :style => 'display: none;') %> <%= link_to_function "Apply", "resizeCropperScaled();" %> | <%= link_to_function "Reset", "cropper.reset(); resize_ratio = 1.0;" %>
<%= text_field :image, :x1, :style => "display: none" %> <%= text_field :image, :y1, :style => "display: none" %> <%= text_field :image, :x2, :style => "display: none" %> <%= text_field :image, :y2, :style => "display: none" %> <%= text_field :image, :width, :style => "display: none" %> <%= text_field :image, :height, :style => "display: none" %>
<%= submit_tag 'Save Thumbnail', class: 'form_button', data: { disable_with: 'Saving...' } %> <%= link_to_function "Cancel", "cancelSelectThumbnail()" %> <%- end -%>