ruby on rails bootsy image upload not working - ruby-on-rails

I'm new to ruby on rails, and I'm trying to add a WYSIWYG editor to my website. I have installed bootsy following the instructions on https://github.com/volmer/bootsy. It is giving me this error whenever I try to upload an image: Failed to manipulate with MiniMagick, maybe it is not an image? Original Error: ImageMagick/GraphicsMagick is not installed
What is going on?

If you see bootsy's readme requirements, you will notice the following:
ImageMagick or GraphicsMagick (for MiniMagick)
This means that to run the plugin you will need ImageMagick installed on your local machine. This is very easy to do.
If you are on Mac:
brew install imagemagick
On Ubuntu:
sudo apt-get install imagemagick
For the other operating systems, you can read more on ImageMagick's official website.

Related

Could not run the `identify` command. Please install ImageMagick

I am using Paperclip and getting this error on the deployed site, not on my local server. And that's why it is becoming more difficult for me to get out of this.
A Paperclip::Errors::CommandNotFoundError occurred in images#update:
enter code hereCould not run the `identify` command. Please install ImageMagick.
I have tried these solutions but was not able to fix this (For ubuntu):
Ran apt-get install imagemagick
I don't use brew. So, won't be able to use brew install imagemagick
Added and deployed these lines to paperclip_options.yml
:image_magick_path: '/opt/ImageMagick/bin'
:command_path: '/opt/ImageMagick/bin'
Can anyone suggest how to resolve this error?

Rails Error on Windows: ImageMagick/GraphicsMagick is not installed

I get this error when i ran my rails app on my Windows Localhost when I tried to upload an image.
I have a "product" model and I am using Mini_Magick with CarrierWave for uploading the product's image.
Image Failed to manipulate with MiniMagick, maybe it is not an image? Original Error: ImageMagick/GraphicsMagick is not installed
I have done the "bundle install" command after putting mini_magick gem in my gem-file and I have checked that Imagemagick is installed by running "convert" everything works fine... What could be the problem?
Have you installed GraphicsMagick on your machine? You will need this installed locally if your doing any kind of image manipulation with your uploads, which it appears you are.
Downloads can be found here:
ftp://ftp.graphicsmagick.org/pub/GraphicsMagick/windows/
Another advise: this error happened to me even after installing GraphicsMagick, I solved it by restarting visual studio code, which is the IDE I'm using. So, be ware of restarting the terminal you are using to run rails after installing GraphicsMagick

ImageMagick-6.8.6-8 Paperclip::Errors::NotIdentifiedByImageMagickError

I have application using Rails 4 and Ruby 2. I started to use mongoid-paperclip and it is working fine.
I installed ImageMagick-6.8.6-8. I added Paperclip.options[:command_path] = "/usr/local/bin/" in development.rb. And I have
mongoid-paperclip
rmagick (~> 2.13.2)
cocaine (0.5.1)
When I added "has_mongoid_attached_file :avatar, :styles => { :small => "160x160!" }" I started to get this error: Paperclip::Errors::NotIdentifiedByImageMagickError: Paperclip::Errors::NotIdentifiedByImageMagickError
Any help please I spent hours and hours without any luck.
NOTE: This solution is for OS-X machines and imagemagick installed via "brew"
Some of my students (I teach Rails at a dev bootcamp) had the exact same problem on their Mac OS-X machines. And, the following solution fixed them all.
The Cause
The cause of the problem is that jmagemagick is compiled using a wrong GCC compiler in your box. Although it probably has compiled into an executable (binary), however, when it runs, it fails due to linking errors (it's trying to dynamically load some dependencies, ie, libraries).
The Solution
You need to reinstall imagemagick using a correct GCC. If you have a Mac, please, follow the instructions below:
Open XCode program (if you don't have it, install it)
Go to Preference and open "Download" tab
Download "Command line tool"
After download is complete, open a terminal
Run "brew reinstall imagemagick"
That should do it!
When using brew install imagemagick, it seems to install a precompiled binary that lacks TIFF support. Use this to install ImageMagick with proper TIFF support:
brew install libtiff
brew reinstall imagemagick --with-libtiff
(Credits to Groveriffic: https://stackoverflow.com/a/13150641/235297)
1- I have the same issue, and I solved it, when i configure the dynamic linker run-time bindings to create the necessary links and cache to the most recent shared libraries using the ldconfig command.
So you need to use the following command:
sudo ldconfig /usr/local/lib
Actually, I advice to re-install imagemagick using steps at how-to-install-image-magick-and-setup-paperclip.
2- You need to add the following code in development.rb file:
Paperclip.options[:command_path] = "/usr/local/bin/"
Running these two commands did the trick for me. Remember to use the --force since libtool is keg-only
brew install libtool --universal
brew link libtool --force

Install ImageMagick for paperclip gem in a Mac OS 10.5.8

I have been trying to install ImageMagick for one week. The documentation I found over the net it is contradictory and I didn't find the proper way to install it and configure it. As well as I am not an UNIX expert so I don´t know how to use Enviroments paths correctly.
My software versions are:
S.O.: Mac OS 10.5.8,
ImageMagick v6.7.7,
Paperclip v3.1.2,
Rails v3.0
Some hints:
The ~/.profile file:
export PATH=$HOME/Users/mac_name/.gem/ruby/1.8/bin:$PATH
export PATH="/usr/local/bin:/usr/local/sbin:/usr/local/mysql/bin:$PATH"
export MAGICK_HOME="/Users/mac_name/ImageMagick-6.7.7"
export DYLD_LIBRARY_PATH=$MAGICK_HOME/lib/
export DISPLAY=:0
I install ImageMagick with an installation script. Its located in: Users/mac_name/ImageMagick-6.7.7
Now I think it´s installed but paperclip it does not run. I still have the error: "Photo Could not run the identify command. Please install ImageMagick".
$ echo $MAGICK_HOME
it returns: "/Users/mac_name/Users/mac_name/ImageMagick-6.7.7" (I don´t know why "Users/mac_name" it is repeated)
I need help. Any other gem that does not need ImageMagick? I am totally upset of this...
I will suggest you to install homebrew and then install imagemagick using that.
To install Homebrew check this. Basically just copy paste this on your terminal:
/usr/bin/ruby -e "$(/usr/bin/curl -fsSL https://raw.github.com/mxcl/homebrew/master/Library/Contributions/install_homebrew.rb)"
Now to install imagemagick run this command:
brew install imagemagick
Lemme know if you face any issues.
Mohit has a great answer but the link seems broken now so checkout either
Homebrew Homepage at http://brew.sh or the Github page at https://github.com/mxcl/homebrew
Both have good instructions on proper installation

Current version of the rmagick gem (2.13.1) doesn't work with current version of ImageMagick (6.6.4)

I'm on OSX Snow Leopard though I think this may not be a platform-specific issue.
The problem is I've wasted hours of my life trying to get gem install rmagick to work and I'm hoping to save the next person that grief.
I believe the core problem is summed up in the title.
Questions:
Can anyone confirm that Rmagick 2.13.1 doesn't work with ImageMagick 6.6.4?
What's the best solution to getting Rmagick installed on Snow Leopard?
Should MacPorts be used to install ImageMagick? (I couldn't figure out how to tell macports to use an old version of ImageMagick.)
And finally:
Getting ImageMagick to work at all now is giving me fits because I've tried installing various versions in various ways and they're interfering with each other.
Below are instructions for purging and reinstalling macports (is that necessary?) but I'm not sure how to clean up other libraries for doing a fresh ImageMagick install.
For example, I currently get the following error trying to run ImageMagick
dyld: Library not loaded: /usr/local/lib/libfreetype.6.dylib
Referenced from: /usr/local/bin/convert
Reason: Incompatible library version: convert requires version 11.0.0 or later,
but libfreetype.6.dylib provides version 10.0.0
Perhaps just getting rid of /usr/local/lib/libfreetype* before reinstalling suffices (I'll confirm here when I get ImageMagick working) but is there a more complete/definitive way to do a fresh install of a specific version of ImageMagick?
Appendix: Purging and reinstalling MacPorts
Purge: http://guide.macports.org/#installing.macports.uninstalling
Reinstall from scratch:
http://distfiles.macports.org/MacPorts/MacPorts-1.9.1-10.6-SnowLeopard.dmg
(as of 2010.10.09 -- check http://distfiles.macports.org/MacPorts for latest version)
Then do sudo port selfupdate just to be sure.
RMagick is an... interesting library. If at all possible, avoid it's usage. If you're just resizing images and other basic things, look at minimagick. The main issue with RMagick stems from memory usage and leaks - not usually apparent in development, but in production they get ugly fast.
My advice would be to look at alternatives if at all possible - if you have to do more complex work, it might actually be preferable to use Python/PIL for that instead (wrapped with Ruby - I use this to get at OpenCV, for example). Depends on your use case.
If you really need RMagick, then Homebrew might work better than ports. I'm a Linux guy where this stuff tends to Just Work, and over there the definitive way to get things like ImageMagick set up properly outside of package managers is to build it from source. Not sure how practical that is on OSX, but it might be worth a shot if all else fails.
I am also stuck trying to install an earlier version of ImageMagick, but I'm trying to do it via Homebrew. Along the way, however, I discovered how to install older packages via MacPorts, and it did work for me (although I had to ditch MacPorts for other reasons).
Instructions for moving to an older port version are here:
https://trac.macports.org/wiki/howto/InstallingOlderPort
Fundamentally, the answer indeed seems to be that you need an older version of ImageMagick for Rmagick to work (at least under Snow Leopard).
I've confirmed that ImageMagick 6.5.6-10 works with Rmagick 2.13.1.
(Rmagick homepage says it's been tested up through ImageMagick 6.6.1-0. Version 6.6.1-0 doesn't seem to be available but probably 6.6.1-10, which is available, is fine too.)
All the troubles with MacPorts were probably mostly red herrings. Still, MacPorts does not seem to have a way to install a previous version of ImageMagick so I installed it from source.
HomeBrew might be a better option.
The errors I was getting with ImageMagick were solved for me by removing /usr/local/lib/libfreetype* and reinstalling ImageMagick.
I also purged and reinstalled MacPorts but I don't know that that was necessary.
Here are the exact steps I took to get this working, as best as I can reconstruct them.
Purge and reinstall MacPorts (see appendix of the question above).
Remove /usr/local/lib/libfreetype*
sudo port -v install freetype +bytecode
sudo port -v install librsvg
I didn't do this but some people might want: sudo port -v install graphviz +gs +wmf +jbig +jpeg2 +lcms
cd /usr/local/src
curl 'ftp://ftp.imagemagick.org/pub/ImageMagick/legacy/ImageMagick-6.5.6-10.tar.gz' > ImageMagick-6.5.6-10.tar.gz (This will probably work too: ftp://ftp.imagemagick.org/pub/ImageMagick/ImageMagick-6.6.1-10.tar.gz)
tar xzvf ImageMagick-6.5.6-10.tar.gz
cd into there but don't follow the instructions in Install-whatever.txt because they're all messed up.
export CPPFLAGS=-I/usr/local/include
export LDFLAGS=-L/usr/local/lib
./configure --prefix=/usr/local --disable-static --with-modules --without-perl --without-magick-plus-plus --with-quantum-depth=8 --disable-openmp --with-gs-font-dir=/usr/local/share/ghostscript/fonts
make
sudo make install
gem install rmagick
Phew! Note that steps 3-14 could probably be replaced with this: http://github.com/masterkain/ImageMagick-sl

Resources