carrierwave

Upload path based on a record value for Carrier wave Direct

江枫思渺然 提交于 2021-02-18 18:11:35
问题 I want to configure an upload path for Carrier wave Direct,which I am using to upload files directly to Amazon s3.In app/uploaders/myuploader.rb ,I have, def store_dir "uploads/#{model.class.to_s.underscore}/#{mounted_as}/#{model.id}" end I want to modify this so that,the path looks like, "uploads/#{model.class.to_s.underscore}/#{mounted_as}/#{User.name}". so it will be some thing like, "uploads/Users/avatar/michael_jordan/.." Where User is the model in which the uploader is mounted. I have

NameError: uninitialized constant CarrierWave::Storage::Fog, heroku

ぃ、小莉子 提交于 2021-02-08 10:18:54
问题 I am trying to use carrierwave, fog and AWS for my image uploading on Heroku. Pretty common...I even have it set up successfully for another app. However when I delpoy to heroku I'm getting this error: Running: rake assets:precompile rake aborted! NameError: uninitialized constant CarrierWave::Storage::Fog Gemfile source 'https://rubygems.org' git_source(:github) { |repo| "https://github.com/#{repo}.git" } ruby '2.3.7' # Bundle edge Rails instead: gem 'rails', github: 'rails/rails' gem 'rails

NameError: uninitialized constant CarrierWave::Storage::Fog

孤者浪人 提交于 2021-02-07 07:50:12
问题 I have tried several solution given on stackoverflow and github, but couldnt find the solution. I am using carrierwave (0.10.0) and fog-aws (0.8.1) gems for my app to upload image to S3. NameError: uninitialized constant CarrierWave::Storage::Fog from /home/pulkit/.rvm/gems/ruby-2.3.0/gems/carrierwave-0.10.0/lib/carrierwave/uploader/configuration.rb:73:in `eval' from /home/pulkit/.rvm/gems/ruby-2.3.0/gems/carrierwave-0.10.0/lib/carrierwave/uploader/configuration.rb:73:in `eval' from /home

Multi step form with image uploader

十年热恋 提交于 2021-02-07 02:58:56
问题 I want to build 3 step user registration with avatar uploading on 2nd step. So i follow Ryan Bates's guide http://railscasts.com/episodes/217-multistep-forms . I'm using CarrierWave gem to handle uploads. But it seems like i can't store uploaded file info in user session (i'm getting can't dump File error). I use following technique in controller if params[:user][:img_path] @uploader = FirmImgUploader.new @uploader.store!(params[:user][:img_path]) session[:img] = @uploader params[:user]

Reprocessing images of different versions in Carrierwave

假装没事ソ 提交于 2021-02-05 20:22:17
问题 Using Carrierwave, I created 3 versions of an avatar - an original, a small_thumb and a large_thumb using the following lines: process :resize_to_limit => [400, 400] version :big_thumb do process :resize_to_limit => [80, 80] end version :small_thumb do process :resize_to_limit => [50, 50] end I added an additional method in my AvatarUploader class: def reprocess(x,y,w,h) manipulate! do |img| img.crop(x.to_i, y.to_i, w.to_i, h.to_i, true) end resize_to_limit(180,180) end which is called in my

How to fix a “value too long for type character varying(255)” error

最后都变了- 提交于 2021-01-28 09:11:36
问题 I'm trying to save a file so that I can upload it to stripe using CarrierWave, but I'm getting the error: ERROR: value too long for type character varying(255) and don't understand why as I followed the CarrierWave usage guide on GitHub. This is my application: class SplitterStripeServer < Sinatra::Base CarrierWave.configure do |config| config.root = File.dirname(__FILE__) + "/public" end post "/" do img = Image.new img.file = params[:file] #carrierwave will upload the file automatically img

Missing required arguments: aws_access_key_id, aws_secret_access_key in server

╄→尐↘猪︶ㄣ 提交于 2020-08-07 08:17:11
问题 I keep getting this error whenever I am trying to start the server validate_options': Missing required arguments: aws_access_key_id, aws_secret_access_key (ArgumentError) I can't seem to solve the issue! I am almost sure that the issue is caused Carrierwave and fog gems to use amazon s3. But I am not sure exactly in which folder the issue is! Here's my initializer/carrierwave.rb: CarrierWave.configure do |config| config.fog_credentials = { :provider => 'AWS', # required :aws_access_key_id =>

Missing required arguments: aws_access_key_id, aws_secret_access_key in server

泪湿孤枕 提交于 2020-08-07 08:17:07
问题 I keep getting this error whenever I am trying to start the server validate_options': Missing required arguments: aws_access_key_id, aws_secret_access_key (ArgumentError) I can't seem to solve the issue! I am almost sure that the issue is caused Carrierwave and fog gems to use amazon s3. But I am not sure exactly in which folder the issue is! Here's my initializer/carrierwave.rb: CarrierWave.configure do |config| config.fog_credentials = { :provider => 'AWS', # required :aws_access_key_id =>

Reprocessing images in Carrierwave

早过忘川 提交于 2020-07-04 07:24:29
问题 Let's say my model has an image with :thumb and the client wants :tiny and :nano thumbnails. How do I reprocess all the existing images using a rake task? I've found a rake task that I thought would do it https://gist.github.com/777788 but it's giving me errors. 回答1: According to the Carrerwave documentation you can use following commands: Model.all.each do |model| model.image.recreate_versions! end 回答2: I wanted to expand on this great answer by Mikhail Nikalyukin To Reprocess a single

Use CDN with carrierwave + fog in s3 + cloudfront with rails 3.1

故事扮演 提交于 2020-07-04 06:40:49
问题 I'm using fog with carrierwave in my website. But the images load very very slowly. Then I want to speed up loading of images with a CDN. I have followed this tutorial for create the CDN for images: http://maketecheasier.com/configure-amazon-s3-as-a-content-delivery-network/2011/06/25 I have now my distribution deployed for images but I don't know how works fine the cdn. I have in initializers/fog.rb the next configuration: CarrierWave.configure do |config| config.fog_credentials = {