I use redactor gem in my Rails application, which is a WYSIWYT editor. This allows users to attach images.
I have this file in the uploaders folder that attaches images to messages made using the redactor gem.
redactor_rails_picture_uploader.rb
class RedactorRailsPictureUploader < CarrierWave::Uploader::Base
include RedactorRails::Backend::CarrierWave
include CarrierWave::MiniMagick
storage :fog
def store_dir
"system/redactor_assets/pictures/#{model.id}"
end
process :read_dimensions
def extension_white_list
RedactorRails.image_file_types
end
end
I do not want to limit users by offering them to upload images of less than 10 or 8 MB.
I also do not want to crop the images.
I would like to compress images by less than 10 or 8 MB in my rails application and not disturb users to crop or compress images.
I have gems like wavewave, mini_magick and they all work. This is my gem file.
source 'https://rubygems.org'
ruby '2.1.4'
gem 'bootstrap-sass', '~> 3.3.1'
gem 'autoprefixer-rails'
gem 'rails', '4.2.0.beta2'
gem 'bcrypt', '3.1.7'
gem 'faker', '1.4.2'
gem 'carrierwave', '0.10.0'
gem 'mini_magick', '3.8.0'
gem 'paperclip'
gem 'aws-sdk'
gem 'fog', '1.23.0'
gem 'will_paginate', '3.0.7'
gem 'bootstrap-will_paginate', '0.0.10'
gem 'mailboxer'
gem 'rack-reverse-proxy', :require => 'rack/reverse_proxy'
gem 'chosen-rails'
gem 'jquery-turbolinks'
gem 'masonry-rails', '~> 0.2.4'
gem 'newrelic_rpm'
gem 'rocket_pants', '~> 1.10.0'
gem "recaptcha", :require => "recaptcha/rails"
gem 'metamagic'
gem 'redactor-rails'
gem 'fitvidsjs_rails'
gem 'pusher'
gem 'sass-rails', '~> 5.0.0.beta1'
gem 'uglifier', '>= 1.3.0'
gem 'coffee-rails', '~> 4.0.0'
gem 'jquery-rails', '~> 4.0.0.beta2'
gem 'jbuilder', '~> 2.0'
gem 'sdoc', '~> 0.4.0', group: :doc
group :development, :test do
gem 'byebug'
gem 'web-console', '~> 2.0.0.beta4'
gem 'spring'
gem 'sqlite3'
end
group :production do
gem 'pg', '0.17.1'
gem 'rails_12factor', '0.0.2'
gem 'unicorn'
end
carrier_wave.rb
if Rails.env.production?
CarrierWave.configure do |config|
config.fog_credentials = {
:provider => 'AWS',
:aws_access_key_id => ENV['S3_ACCESS_KEY'],
:aws_secret_access_key => ENV['S3_SECRET_KEY'],
:region => ENV['S3_REGION'],
:path_style => true
}
config.fog_directory = ENV['S3_BUCKET']
end
end
- , ?
. .