Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

this is a significantly simpler Paperclip processor, before the proce…

…ssor was copied verbatim from the Thumbnail processor
  • Loading branch information...
commit 0ebdf4350ce8fe30a6dcc9bc7dfcca950c349d76 1 parent ac7f612
@agrobbin authored
Showing with 6 additions and 27 deletions.
  1. +6 −27 lib/paperclip_processors/learn_how.rb
View
33 lib/paperclip_processors/learn_how.rb
@@ -1,42 +1,21 @@
module Paperclip
class LearnHow < Thumbnail
- # Performs the conversion of the +file+ into a thumbnail. Returns the Tempfile
- # that contains the new image.
- def make
- src = @file
- dst = Tempfile.new([@basename, @format ? ".#{@format}" : ''])
- dst.binmode
-
- begin
- parameters = []
- parameters << Rails.root.join('app', 'assets', 'images', 'learn-how.jpg')
- parameters << resize_and_position_command
- parameters << ":dest"
-
- parameters = parameters.flatten.compact.join(" ").strip.squeeze(" ")
-
- success = convert(parameters, :source => "#{File.expand_path(src.path)}#{'[0]' unless animated?}", :dest => File.expand_path(dst.path))
- rescue Cocaine::ExitStatusError => e
- raise Paperclip::Error, "There was an error processing the thumbnail for #{@basename}" if @whiny
- rescue Cocaine::CommandNotFoundError => e
- raise Paperclip::Errors::CommandNotFoundError.new("Could not run the `convert` command. Please install ImageMagick.")
- end
-
- dst
- end
-
- def resize_and_position_command
+ def source_file_options
scale, crop = @current_geometry.transformation_to(@target_geometry, crop?)
resize = @current_geometry.resize_to(scale)
left = 58 + ((@target_geometry.width - resize.width) / 2)
resize_and_position = []
+ resize_and_position << Rails.root.join('app', 'assets', 'images', 'learn-how.jpg')
resize_and_position << '-draw'
resize_and_position << '"image Over'
resize_and_position << [left, '0', resize.width, resize.height].join(',')
- resize_and_position << ':source"'
resize_and_position
end
+ def transformation_command
+ ["\""]
+ end
+
end
end
Please sign in to comment.
Something went wrong with that request. Please try again.