Skip to content

Instantly share code, notes, and snippets.

@toothfairy
Created February 28, 2012 11:02
Show Gist options
  • Save toothfairy/1931905 to your computer and use it in GitHub Desktop.
Save toothfairy/1931905 to your computer and use it in GitHub Desktop.
resize_to_fill image with sizes from model
class CoverUploader < CarrierWave::Uploader::Base
include CarrierWave::RMagick
version :some_vesion do
process :do_resize
end
def do_resize
manipulate! do |img|
sizes = model.cover_type.split('x').map { |t| t.to_i }
img.resize_to_fill(sizes[0], sizes[1])
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment