to directory you want to work in. cd /tmp # Clone Demo Project from GitHub git clone [email protected]:mitour/railsdemo.git # Switch to Project Directory cd railsdemo # Delete .git directory rm -rf .git # Run the following command: bundle install rake db:migrate Yu-Sheng Li, April 10th, 2015 2
Gemfile: gem 'carrierwave' # In terminal, switch to your project directory, and run: bundle install 1 For more details on this gem, please refer to official GitHub page Yu-Sheng Li, April 10th, 2015 3
help us process image # Uncomment the following code in corresponding uploader include CarrierWave::MiniMagick 2 MiniMagicK is recommended on the Official guide. RmagicK is reported that it eats up huge amounts of memory, and may cause memory leak, so in order to make sure everything works fine on a remote server, we're going to use MinimagicK instead. Yu-Sheng Li, April 10th, 2015 10
need to install Imagemagick on your computer3 # For OSX: brew install imagemagick # For Ubuntu apt-get install imagemagick # For CentOS yum install imagemagick 3 You must have Imagemagick and MiniMagick installed to do image resizing. MiniMagick is a Ruby interface for Imagemagick which is a C program. This is why MiniMagick fails on 'bundle install' without Imagemagick installed. Yu-Sheng Li, April 10th, 2015 11
following lines version :thumb do process :resize_to_fill => [150, 150] end version :medium do process :resize_to_fill => [350, 350] end 4 See more details on RubyDoc Yu-Sheng Li, April 10th, 2015 13
following block of codes in Rails Console Post.find_each do |post| unless post.picture.thumb.file? || !post.picture? post.picture.recreate_versions!(:thumb) end Yu-Sheng Li, April 10th, 2015 14
# We're going to use gem: fog # In Rails, add it to your Gemfile: gem "fog" # Optimized Loading of Fog gem "fog", require: "fog/google/storage" 5 Sign up at Google Cloud Platform, and request an API from Google APIs Console Yu-Sheng Li, April 10th, 2015 16