carrierwave + mini_magick gems = not an image error - ruby-on-rails-3

I'm using:
- carrierwave 0.6.0
- rails 3.2.1
- mini_magick 3.4
- ruby 1.9.2p290
And during image uploading I want to resize uploading pic:
(image_uploader.rb)
process :resize_to_fit => [200, 200]
But after image uploading I've got an error:
1 error prohibited this organization from being saved:
Image image Failed to manipulate with MiniMagick, maybe it is not an image? Original Error: MiniMagick::Invalid
PS. If I'm not resizing, image upload works fine.
PS2. I tried to add in config/environment.rb:
require 'rubygems'
require "mini_magick"
but without success (still not working - btw. is it required when using mini_magick as a gem?)

I'm sure that you've solved this by now (at least hopefully! It's almost two months later!), but here's a solution that worked for me just now:
Uninstall imagemagick through homebrew:
brew uninstall imagemagick
Clean your homebrew directory:
brew cleanup --force -s
--force removes all out of date keg-only brews, -s removes all cached downloads
Reinstall imagemagick:
brew install imagemagick
After all of that, you should be good to go!

B. Ruschill's answer seemed to have solved many peoples' problem, unfortunately it didn't for me. Nor did many solutions I found on the internets.
Turns out I had an outdated version of libjpeg. I fixed that by removing and re-installing using brew. This may happen for other image formats too. Perhaps doing the same for the respective libs might solve the problem.
TL;DR
brew remove libjpeg
brew install libjpeg

Related

RMagick installed but ZenTest doesnt work (Invalid gemspec error)

Hello I have Windows 7 64b and I want to use CarrierWave gem for working with file uploads. I needed to install RMagick... I have succesfully installed rmagick 2.13.2
but if I run
rails g uploader image
it thows me
Invalid gemspec in [C:/web/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/specific
ations/ZenTest-4.9.2.gemspec]: Illformed requirement ["< 2.1, >= 1.8"]
I thought that updating rubygem should help so I did it. Now I have rubygems version 2.0.3 (I hope its not a problem because downgrading like gem update --system 1.9.3 its not working)
I'm not able to uninstall ZenTest too... what I have to do? Thank you!
I uninstalled RailsInstaller and deleted Ruby folder, i deleted JRuby folder from C:\ (i had it for other work) and again installed RailsInstaller and now it works :-)

WebStorm LESS Filewatcher Could not find RubyGem less

I'm getting this error trying to use the WebStorm LESS File Watcher
/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/rubygems.rb:777:in `report_activate_error': Could not find RubyGem less (>= 0) (Gem::LoadError)
from /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/rubygems.rb:211:in `activate'
from /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/rubygems.rb:1056:in `gem'
from /Users/me/.rvm/gems/ruby-1.9.3-p194/bin/lessc:18
from /Users/me/.rvm/gems/ruby-1.9.3-p194/bin/ruby_noexec_wrapper:14
I'm running OSX Mountain Lion
How do I fix it?
EDIT:
I did this...
gem install less
Successfully installed less-2.3.2
1 gem installed
Didn't help.
EDIT 2:
I fiddled with the path in the LESS Filewatcher setup panel
and now I get this
/Users/me/.rvm/gems/ruby-2.0.0-p195/bin/lessc --no-color bootstrap.less
env: ruby_noexec_wrapper: No such file or directory
It feels like progress, but alas I'm not compiling less to css yet.
You don't need to remove any ruby version. Just switch to the system version of ruby and install the compiler.
rvm use system
sudo gem install less
rvm use default
Ok what I did was this
With rvm remove all other versions of ruby
rvm remove 2.0.0-p195
Install this gem in the system version of ruby
sudo gem install rubygems-bundler
install the less gem
sudo gem install less
sudo gem install therubyracer
I am sure someone can give me a better way of doing this but this ruby thing has a pretty steep learning curve that I really am not interested in pursuing.
This is the way I did it...if someone wants to contribute a better way please share here to save someone else the 4 hours I just lost to it.

RVM: Incorrect Ruby version referenced after removal

Just updated the version of Ruby (1.9.2 to 1.9.3) I have installed but now getting the following error when running rake:
$ rake
-bash: /Users/mike.simmonds/.rvm/gems/ruby-1.9.3-p0/bin/rake: /Users/mike.simmonds/.rvm/rubies/ruby-1.9.2-p180/bin/ruby: bad interpreter: No such file or directory
Any tips?
It appears reinstalling the rake gem has fixed it.
looks like a gem pristine task failed and you had older rvm, I have already changed the upgrade code to run upgrade for every gem separately and report you list of failed gems.
It's important to read outputs of rvm, even we try to automate things and make things very easy - sometimes there is not much we can do with the available tools.

Problem w/ Paperclip, MacPorts, ImageMagick & Snow Leopard

I'm attempting to use ImageMagick along w/ Paperclip to handle the images on my rails app. The problem is whenever I try to upload an image I get the following in the terminal:
[paperclip] An error was received while processing: #<Paperclip::NotIdentifiedByImageMagickError: /var/folders/go/goZ833AaFaqyvv5RnLqQmE+++TM/-Tmp-/stream20110107-6356-1xfs9j1-0.jpg is not recognized by the 'identify' command.>
I have added the following to my environments/development.rb file:
Paperclip.options[:command_path] = "/usr/local/bin"
If I try to interact w/ ImageMagick in the terminal by using "convert" or something similar I get:
dyld: Library not loaded: /opt/local/lib/libltdl.7.dylib
Referenced from: /usr/local/bin/convert
Reason: Incompatible library version: convert requires version 10.0.0 or later, but libltdl.7.dylib provides version 9.0.0
Trace/BPT trap
I've already tried updating everything w/ port but the problem still persists. Does anyone have any ideas or suggestions?
I strongly suggest giving up macports and using homebrew. I've never once missed macports since changing. Homebrew uses git and ruby (tools you should be familiar with), and all the installation 'formulae' are very easy to follow. Here's the imagemagick one:
https://github.com/mxcl/homebrew/blob/master/Library/Formula/imagemagick.rb
Note that it spends a lot of time working around 'gotchas'. To install, you would just run:
brew install imagemagick
You appear have an older version of libtool. Running
"otool -LD /opt/local/lib/libltdl.7.dylib" should show you that. I had a similar issue, and solved it by uninstalling ImageMagick completely, then running
sudo port selfupdate
sudo port upgrade outdated (which upgraded libtool, btw)
and then reinstalling ImageMagick.
Just had the same issue, easily fixed it.
You may want to uninstall / reinstall the rmagick gem:
gem uninstall rmagick
gem install rmagick
Worked like a charm for me

Problem installing Heroku with Rails3, Ruby 1.9.2

I am using Ubuntu 10.10, RVM and Ruby 1.9.2 and trying to install Heroku for the first time. Ruby 1.9.2 is the default for RVM and the only version I have been using.
The gem install heroku worked but trying to run heroku leads to "command not found" error. The executables folder /home/mike/.rvm/gems/ruby-1.9.2-p0/bin is already in the PATH. However, I see that Heroku was installed in /var/lib/gems/1.8/gems. gem list heroku does not show any installed gem. Simply creating symbolic links in .../ruby-1.9.2-p0 did not solve the problem, though it gives a different error:
/usr/lib/ruby/1.8/rubygems.rb:779:in `report_activate_error': Could not find RubyGem heroku (>= 0) (Gem::LoadError)
from /usr/lib/ruby/1.8/rubygems.rb:214:in `activate'
from /usr/lib/ruby/1.8/rubygems.rb:1082:in `gem'
from /home/mike/.rvm/gems/ruby-1.9.2-p0/bin/heroku:18
I don't understand gem and rvm well enough to know what to try next. I read in another question that Heroku supports Ruby 1.9.1 but not 1.9.2 but don't know if that is still true. If so, how does one use Rails and Ruby 1.9.x with Heroku?
The problem turned out to be related to sudo and Ubuntu. RVM depends on the rvm_path environment variable to get started. According to answers to another question, sudo does not preserve the PATH variable in some versions of secure Linux. I don't know if it should ever preserve the rvm_path variable, but in any case, it does not on my version of Ubuntu. So the result of sudo gem install is that the default, RVM-provided version of Ruby is not available during the installation, and the system-default is used. In my case that is version 1.8. The installation appears to succeed, but it is not going to the right gem version.
The solution was simply to use gem install instead of sudo gem install.
If 'gem list' doesn't show the Heroku gem then that would seem to be the problem (the error you posted occurs when running a Heroku command without the gem installed).
Have you tried installing it again? Any error messages?
It does work with 1.9.2.
Had the exact same problem on Mac OSX 10.6.5. Reinstalling without sudo worked in this case also. Thanks for the explanation... being a nube, I would have never figured it out.