13

I'm trying to use MiniMagick to resize images and I did the following in my controller file:

require 'rubygems'
require 'mini_magick'

and

img = MiniMagick::Image.open(file)

But when I invoke the controller the following

LoadError (cannot load such file -- mini_magick)

I've added gem 'mini_magick' to my Gemfile so I have really no idea what's going on. Can someone help me with this?

BTW, it is available in both irb and rails console, but not when run as a server.

Thx in advance.

Guanlun
  • 1,598
  • 2
  • 18
  • 29

6 Answers6

27

Dammit, restarting the server solved it..

Guanlun
  • 1,598
  • 2
  • 18
  • 29
4

Add gem "mini_magick" to your Gemfile

and restart your server.

Heartless Vayne
  • 904
  • 1
  • 8
  • 18
1

In my case:

gem 'image_processing'
shilovk
  • 11,718
  • 17
  • 75
  • 74
0

I was also facing this issue. Just uncomment the line

include CarrierWave::MiniMagick 

in your uploader file and make sure you have commented the line

include CarrierWave::RMagick

So your setting in uploader file should look like this:

# include CarrierWave::RMagick
include CarrierWave::MiniMagick
pzin
  • 4,200
  • 2
  • 28
  • 49
Afzal Masood
  • 4,293
  • 1
  • 14
  • 18
0

Some times this problem is caused by not having the latest version of the gems. It can be fixed by running bundle update.

AaronG
  • 84
  • 8
0

Whenever you have this error just add gem "mini_magick" and restart your server using the rails s command. But most importantly, remember to always check your server logs on your terminal for the error message. They are your best friend in figuring out the solution you need for your problem.

Christopher Bradshaw
  • 2,615
  • 4
  • 24
  • 38