Reputation: 514
if i uploade a image, the original version and the thumb version is created but the thumb version is not saved in the database.
class Image < ActiveRecord::Base
mount_uploader :image, ImageUploader
end
# encoding: utf-8
class ImageUploader < CarrierWave::Uploader::Base
# Create different versions of your uploaded files:
version :thumb do
process :resize_to_limit => [50, 50]
end
end
Upvotes: 1
Views: 462
Reputation: 7070
It won't save it in the database. Rather, you'll see a new thumbnail version in your upload directory. You can call this version by referencing to that version when calling the image field.
ie
<%= image_tag @image.image(:thumb).url %>
Upvotes: 1