Railsで画像アップロードで使うGemのメモ

完全にメモ

Carrierwave

Github : carrierwaveuploader/carrierwave

rmagick

Github : rmagick/rmagick/

dropzonejs-rails

Dropborn.js : dropborn.js

Github : ncuesta/dropzonejs-rails

jQuery-File-Upload

Github : jQuery-File-Upload

jquery-fileupload-rails

jQuery-File-UploadのGem

Github : tors/jquery-fileupload-rails

gem install するときrmagickでこける

$ sudo yum -y install ImageMagick
$ sudo yum -y install ImageMagick-devel

fogを使うとbundle installでエラーがでた

Fetching ovirt-engine-sdk 4.2.4
Installing ovirt-engine-sdk 4.2.4 with native extensions
Gem::Ext::BuildError: ERROR: Failed to build gem native extension.

    current directory: /home/centos/app_name/vendor/bundle/ruby/2.4.0/gems/ovirt-engine-sdk-4.2.4/ext/ovirtsdk4c
/home/centos/.rbenv/versions/2.4.0/bin/ruby -r ./siteconf20180924-32416-iap465.rb extconf.rb
checking for xml2-config... no
*** extconf.rb failed ***
Could not create Makefile due to some reason, probably lack of necessary
libraries and/or headers.  Check the mkmf.log file for more details.  You may
need configuration options.

Provided configuration options:
  --with-opt-dir
  --without-opt-dir
  --with-opt-include
  --without-opt-include=${opt-dir}/include
  --with-opt-lib
  --without-opt-lib=${opt-dir}/lib
  --with-make-prog
  --without-make-prog
  --srcdir=.
  --curdir
  --ruby=/home/centos/.rbenv/versions/2.4.0/bin/$(RUBY_BASE_NAME)
  --with-libxml2-config
  --without-libxml2-config
  --with-pkg-config
  --without-pkg-config
extconf.rb:29:in `<main>': The "libxml2" package isn't available. (RuntimeError)

To see why this extension failed to compile, please check the mkmf.log which can be found here:

  /home/centos/app_name/vendor/bundle/ruby/2.4.0/extensions/x86_64-linux/2.4.0-static/ovirt-engine-sdk-4.2.4/mkmf.log

extconf failed, exit code 1

Gem files will remain installed in /home/centos/app_name/vendor/bundle/ruby/2.4.0/gems/ovirt-engine-sdk-4.2.4 for inspection.
Results logged to /home/centos/app_name/vendor/bundle/ruby/2.4.0/extensions/x86_64-linux/2.4.0-static/ovirt-engine-sdk-4.2.4/gem_make.out

An error occurred while installing ovirt-engine-sdk (4.2.4), and Bundler cannot continue.
Make sure that `gem install ovirt-engine-sdk -v '4.2.4' --source 'https://rubygems.org/'` succeeds before bundling.

In Gemfile:
  fog was resolved to 2.0.0, which depends on
    fog-ovirt was resolved to 1.1.2, which depends on
      ovirt-engine-sdk

gem を fogからfog-awsに変えて

config.fog_provider = 'fog-aws'

を追加。

CarrierWave.configure do |config|
  config.fog_provider = 'fog-aws'
  config.fog_credentials = {
    (略)
  }
end