Class: Paperclip::SimpleCrop
- Inherits:
-
Thumbnail
- Object
- Thumbnail
- Paperclip::SimpleCrop
- Defined in:
- lib/simple_crop/paperclip_processors/processor.rb
Instance Method Summary collapse
- #normal_transformation_command ⇒ Object
- #simple_crop_string ⇒ Object
- #transformation_command ⇒ Object
- #wants_simpe_crop? ⇒ Boolean
Instance Method Details
#normal_transformation_command ⇒ Object
3 |
# File 'lib/simple_crop/paperclip_processors/processor.rb', line 3 alias :normal_transformation_command :transformation_command |
#simple_crop_string ⇒ Object
20 21 22 |
# File 'lib/simple_crop/paperclip_processors/processor.rb', line 20 def simple_crop_string @attachment.instance.simple_crop_string end |
#transformation_command ⇒ Object
4 5 6 7 8 9 10 11 12 13 14 |
# File 'lib/simple_crop/paperclip_processors/processor.rb', line 4 def transformation_command if wants_simpe_crop? scale, crop = @current_geometry.transformation_to(@target_geometry, crop?) trans = [] trans << "-crop" << %["#{simple_crop_string}"] trans << "-resize" << %["#{scale}"] unless scale.nil? || scale.empty? trans else normal_transformation_command end end |
#wants_simpe_crop? ⇒ Boolean
16 17 18 |
# File 'lib/simple_crop/paperclip_processors/processor.rb', line 16 def wants_simpe_crop? eval (%w(x y w h).collect {|v| "[email protected]_crop_#{v}.blank?"}.join(" and ")+" and [email protected]_crop_style.blank? and @attachment.instance.simple_crop_style.to_sym == options[:name]") end |