I am getting the following error when uploading an image on the admin panel of spree (RoR e-commerce platform):
Paperclip::NotIdentifiedByImageMagickError in Admin/imagesController#create
/tmp/stream.4724.0 is not recognized by the 'identify' command.
Any ideas? Thanks.
It sounds like the wrong identify command (which is part of ImageMagick) is being called (or, perhaps, it isn't installed at all). Can you confirm the path to this command on your server using:
which identify
Once you've determined where this command is installed (e.g. /usr/local/bin) then you can tell Paperclip about it by adding the following to your environment.rb (or production.rb etc) file:
Paperclip.options[:command_path] = '/usr/local/bin/'
(this is for Paperclip 2.2 and above. If you're using an earlier version you should use :image_magick_path not :command_path)
I solved this problem by
$ sudo apt-get install imagemagick
I'm not saying this is the solution but it wouldn't hurt to check your file permissions. Can the user running imagemagick access files in /tmp/ ?
Related
I try to upload a product image to my Spree app, but i get this error
5errors prohibited this record from being saved:
Attachment Paperclip returned errors for file 'index.jpg' - check ImageMagick installation or image source file.
Attachment Paperclip::Errors::NotIdentifiedByImageMagickError
Attachment Paperclip::Errors::NotIdentifiedByImageMagickError
Attachment Paperclip::Errors::NotIdentifiedByImageMagickError
Attachment Paperclip::Errors::NotIdentifiedByImageMagickError
Should i install a gem, relocate my src image? Whats the problem here
You should to install ImageMagick. Follow these steps for install on Windows:
Download ImageMagick (you need to choose static version for your 32/64 bit OS)
Checked Add application directory to your system path and install
Reopen your command prompt to reload your PATH variables
Run convert -v to check the install worked
Okay so the problem is pretty complicated and after trying to solve it for about 3 hours i finally got it.
First, you have to remove the convert.exe from your System32 files.
We do this, because the Spree app relies on legacy code and when it
tries to upload the image the default convert.exe starts, we don't
want that.
Second you download and install the dynamic installation from the imagemagick site and you have to be sure to check the legacy support so the convert command gets supported.
I dont know if you have to, but i installed the paperclip gem. You may have to do that for it to work.
The whole reason this bug happens, is because Windows. So if you are new to this party, dual boot your station or swap to Ubuntu/Mac whatever. Seriously though, when the app tries to upload it uses the convert command, but convert is already a default Windows command so you can't upload the picture properly. So we disable the command and then we replace it with our imagemagick installation. That's it.Also good luck trying to delete the convert.exe from system32, its a weird process, but you can solve it with some google-fu.
Thanks to Michael for pointing me to right way.
I'm trying to setup ImageMagick so I can use the Paperclip gem for Ruby on Rails. I've looked at pretty much every question on StackOverflow about the issue, but they all just skip over my issue, that none of the ImageMagick commands are recognized on the CommandPrompt.
I downloaded and then installed ImageMagick-7.0.1-1-Q16-x64-dll.exe on this page
I installed the program to my C: directory, so that there wouldn't be an issue with spaces in the Path, and I used all default installation selections and even selected "Install development headers" which some answers said to do. My issue is that when ImageMagick finishes installing, and it says to test some commands (like "convert -version) on Command Prompt, they all result in
"'convert' is not recognized as an internal or external command ...."
On the command prompt. What could be an issue? Every step-by-step tutorial automatically assumes that these commands are recognized. Most troubleshooting involves steps afterwards.
Here's the documentation for paperclip. All I have to do is make sure the gem has access to ImageMagick, by putting in the development.rb file:
Paperclip.options[:command_path] = "/usr/local/bin/"
In order to find that path above, however, the documentation says to type "which convert". I've researched this and apparently that's a Unix command, and not something for Windows.
So basically, what steps do I need to take so that paperclip has access to ImageMagick? Why aren't basic ImageMagick commands recognized, even after a completed installation?
When you install ImageMagick under Windows, they is a button you need to check that tells the script to install "legacy" utilities such as convert. Reinstall, click on this button, and convert is ready to use. Alternatively, install ImageMagick 6.X which deploys convert automatically.
Windows users, I've answered most of this here.
The windows command line won't run which convert. You'll need to use something like git bash.
Reinstalling image magick won't hurt. You could try another file. I know the dll one (you mentioned) is top of the list, the next one is 64bit as well. You must check every option at install as paperclip will use lots of image magick functionality behind the scenes so check all options. Then restart the system.
in command before typing convert you have to type in magick then convert
keep in mind you are using a newer version of IM hence you have to start by typing 'magick' and then follow other command
I set up a app in windows using paperclip and imagemagick and it works fine.
Now, I had to migrate this APP to linux.
I already have paperclip's gem and imagemagick but I can't make it work.
I keep getting this message when saving the image:
sh: identify: command not found
Why? Am I missing something?
Thank you!
ps: I'm able to run the "identify" command from my app's directory.
Within your config/environments/development.rb file (or production if necessary) you can add Paperclips command_path option:
Paperclip.options[:command_path] = '/opt/local/bin'
You will want to replace /opt/local/bin with the directory path returned typing in your command line:
$ which identify
imagemagic and wkhtml are available in users/mithin
I have tried setting the path in profile file.
This is the content of .profile :
export PATH="/usr/bin:/usr/local/bin:$PATH"
export PATH="/usr/local/mysql/bin:$PATH"
export PATH="/Users/mithin/:$PATH"
export PATH="/Users/mithin/ImageMagick-6.6.7/bin:$PATH"
When I try to run "identify" in terminal it runs properly
And when I try to run my Ruby on rails project it gives error.
Similar things happen with "wkhtmltopdf"
in terminal it runs properly
but in ror output it gives :
sh: wkhtmltopdf: command not found
Can anyone please point my mistake ?
For Paperclip to find the commands outside of the default install location, add the following to the appropriate file within /config/environments/
Paperclip.options[:command_path] = "/Users/mithin/ImageMagick-6.6.7/bin"
Image Paperclip::CommandNotFoundError
I am getting this error.
Installed Image magick, rmagic both specified path in developement.rb
Paperclip.options[:command_path] = "/opt/local/bin"
Using Snow Leapord
check logs to see which command failed. probably it looks for other complementary executables not present in your custom path. for example paperclip also needs 'identify' command, provided with imagemagick. so be sure to have all executables you need.
Try putting the Paperclip.options[:command_path] in a file in config/intializers
Removing this line worked for me.
Paperclip.options[:command_path] = "/opt/local/bin"
make sure you have RMagick installed