Reputation: 3522
I'm using carrierwave, minimagick and Rails 4.
I have a FileUploader that looks like:
class FileUploader < CarrierWave::Uploader::Base
include CarrierWave::MiniMagick
version :thumb, if: :image? do
process :resize_to_limit => [50, 50]
end
version :thumb, unless: :image? do
process :cover
process :resize_to_fill => [50, 50, Magick::NorthGravity]
process :convert => 'png'
end
protected
def image?(new_file)
new_file.content_type.start_with? 'image'
end
def cover
manipulate! do |frame, index|
frame if index.zero?
end
end
end
If pdf's are uploaded, I'm trying to create a thumb png version of the first page. If images are uploaded, I'm resizing and saving a thumb version of that.
I get the error: NameError (uninitialized constant FileUploader::Magick)
now, though it works when I take away the block with the unless
Upvotes: 0
Views: 118
Reputation: 26
Magick::NorthGravity
constant is part of rmagick
gem (see here), not part of mini_magick
.
Upvotes: 1