This question was asked, but no answer given...I'm having the same issue.
I'm using carrierwave for uploading files everything works great until i wanted to create thumbs
images are saved in a tmp direct, but kept at the same size...
My avatar_uploader.rb file looks like this:
class AvatarUploader < CarrierWave::Uploader::Base
include CarrierWave::RMagick
storage :file
def store_dir
"uploads/#{model.class.to_s.underscore}/#{mounted_as}/#{model.id}"
end
version :thumb do
process :resize_to_limit => [200, 200]
end
My view has the following:
<% for image in @posts %>
<%= image_tag image.avatar_url(:thumb) if image.avatar? %>
<%= image.title %>
<% end %>
When I don't include (:thumb), I see the full images...but when I do include the (:thumb), I get the following error:
Version thumb doesn't exist!
below is my model setup
class Post < ActiveRecord::Base
attr_accessible :comments, :frame, :title, :twitter, :avatar
belongs_to :user
mount_uploader :avatar, AvatarUploader
end
I can see that a tmp directory was created, but images not resized...I have imagemagick and rmagick installed...
Thank you
I think you might want to recreate versions since you might have create thumb size for some images after you uploaded some other files.
image.avatar.url(:thumb)
above syntax is fine
To recreate versions try running
image.avatar.recreate_versions!
on all avatars you might be missing.
Try one of these syntaxes:
image.avatar.thumb.url
# or
image.avatar.url(:thumb)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With