Search code examples
rubyamazon-s3sinatracarrierwavefog

Carrierwave not resizing images on S3


On development, it's correctly creating a resized version of original image and storing both of them, but on s3, it's just uploading 2 identical versions without any kind of modification (apart from renaming it). There are no exceptions shown anywhere. Any idea where the problem might be?

CarrierWave.configure do |config|
  config.fog_credentials = {
    :provider               => 'AWS',
    :aws_access_key_id      => 'a',
    :aws_secret_access_key  => 'a',
    :region                 => "us-west-1"
  }
  config.fog_directory  = 'a'
end

class ImageUploader < CarrierWave::Uploader::Base

  include CarrierWave::MiniMagick

  def store_dir
    "images/#{model.id}"
  end

  version :normalized do
    process :resize_to_limit => [450,450]
  end

  def extension_white_list
    %w(jpg jpeg gif png)
  end

  if Sinatra::Base.development?
    storage :file
  else
    storage :fog
  end
end

Solution

  • Although there were no errors, running "convert -version" on production machine revealed that imagemagick was not installed. Installation fixed the issue.