1

I can upload an image to S3 but when I try to resize it before uploading it does not work. I check around and around but could not find an explanation.

It is Rails4 using Mongoid. It seems it process :resize_to_fit => [300, -1] that is creating the problem as when I remove it it is find, but I don't want the user to upload large photo.

class ImageUploader < CarrierWave::Uploader::Base
  include CarrierWave::MiniMagick
  storage :fog

  def store_dir
    "uploads/#{model.class.to_s.underscore}/#{mounted_as}/#{model.id}"
  end

  process :resize_to_fit => [300, -1]

  def extension_white_list
    %w(jpg jpeg gif png)
  end
end

In my gemfile

 gem 'carrierwave'
 gem 'carrierwave-mongoid', :require => 'carrierwave/mongoid'
 gem 'fog'
 gem 'mini_magick'

In my controller: (it always go to the else and flash the error message)

def update
  if @startup.update(startup_params)
    redirect_to startup_path(@startup)
  else
    flash.now[:error] = "The profile was not saved, please try again."
    render :edit
  end
end

Thank you

2
  • I am getting the same issue, I have tried just about everything I can think of. Using S3, and local server. Updating Gem's to latest. Trying on another computer (Thinking that it was image magic). But even when I call the recreate_versions! and save! it doesn't throw an error, the image seems to be processed, but it never saves the correct size. I would love some insight to this.
    – tspore
    Jul 6, 2014 at 6:03
  • Thank you, at least I am not the only one. I will let you know if I find a solution
    – Chleo
    Jul 10, 2014 at 14:44

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.