I am writing some integration specs that test forms for uploading user content to a site. I get the following error though I have ImageMagick installed and it is working perfectly in the development environment.
[paperclip] An error was received while processing: #<Paperclip::Errors::CommandNotFoundError: Could not run the `identify` command. Please install ImageMagick.>
I know I could stub out ImageMagick as described here however I would like to get it working without stubbing out the service. How do I make sure Rspec can access ImageMagick?
I needed to add the Paperclip command path to the environments/test.rb file.
To do this I typed which convert in the terminal to get the ImageMagick path which was /usr/local/bin/convert. I used this info to insert the following line in the test environment file:
Paperclip.options[:command_path] = "/usr/local/bin/"
Done
Related
This error only happens when executed by the Ruby on Rails server.
I've tried bypassing Carrierwave's resize option by implementing my own but it has the same result.
when I run a script from command line (in which I require the 'mini_magick' gem). It all works flawlessly.
the MiniMagick gem seems to be installed correctly and to be honest I'm kinda out of ideas to tackle this problem.
some versions (not sure if usefull or not):
ruby - 1.9.3p545
rails - 4.1.1
mini_magick - 4.0.1
ImageMagick - 6.9.0-0 Q16
Any help is appreciated.
-edit, I'm using windows 8.1
example code:
require 'mini_magick'
filename = 'test.jpg'
image = MiniMagick::Image.open(filename)
image.resize "1000x1000"
image.format "png"
image.write "test.png"
The code above works flawlessly when executed from cmd.
thumb = MiniMagick::Image.open(i.image.path)
thumb.resize "200*200"
code snippet above throws error in RoR when placed in a controller (Create)
alternatively, uncommenting the resize option directly from carrierwave throws the exact same error.
# version :thumb do
# process :resize_to_fill => [200, 200]
# end
Also a little note:
I've disabled minimagicks validations to figure out what causes the error it threw at that time:
Failed to manipulate with MiniMagick, maybe it is not an image? original error: executable not found: "identify"
I hope this clears a few things up.
-edit
I've decided to leave windows as a dev platform and switch to linux as a dev platform. fixed all of my issues (In hindsight my error was probably due to some lacking dependencies on the imagemagick side).
I experienced a similar problem recently with the following environment:
Windows 8.1
Ruby 2.1.5p273
Ruby Dev Kit 2.1.5
Rails 4.2.0.beta4
carrierwave 0.10.0
mini_magick 4.0.1
ImageMagick6.9.0-Q16 installed at C:\ImageMagick-6.9.0-Q16
In the rails console within RubyMine, I would get:
executable not found: "identify"
after keying in just two things:
filename = 'test.jpg'
image = MiniMagick::Image.open(filename)
One of the steps was to add C:\ImageMagick-6.9.0-Q16 to my Windows PATH environment variable. At first, that didn't help. However, after closing and re-opening RubyMine, the problem went away -- I assume because the change to the PATH env var (done with an independent Windows command prompt) didn't affect the RubyMine IDE environment.
executable not found: "identify"
This is an error message from MiniMagick (Source code). I guess, as the error message says, your server cannot find executable "identify".
Make sure that your ENV['PATH'] has the path to where the "identify" exists.
I'm running into the same problem.
it works flawlessly on my localhost, but on the server (windows 2012), it only works as a rake task. when run inside the application, then it fails saying
NoMethodError (undefined method `resize' for #<MiniMagick::Image:0x28c3260>):
Unfortunately, the path variable is set...
I got it to work by doing the minimagick-stuff inside the model instead of the controller.... nasty workaround.
I'm using wicked_pdf gem to generate pdf files in my Rails application. This gem uses wkhtmltopdf to convert a HTML file to PDF.
The HTML files I'm converting to PDF contains JavaScript used to generate charts. In order to wkhtmltopdf properly render those charts I need to set the use_xserver option to true.
Everything works fine locally. However, when I try it on Heroku, I get the following error message:
Error: PDF could not be generated!
Command Error: wkhtmltopdf-amd64: cannot connect to X server
Does Heroku runs a X server? Is it possible to do so?
You probably shouldn't run an X-server in the dyno just to generate pdfs. It looks like wkhtmltopdf can be made to run headless, check out these questions:
wkhtmltopdf: cannot connect to X server
wkhtmltopdf extremely slow on Debian without X-server
My rails app has an image upload which uses the latest versions of Carrierwave and MiniMagick. It works great on the server, but in my local host which is WEBrick and Windows 7, i get this error when i try and upload an image:
Errno::ENOENT in PostsController#create
No such file or directory - identify -ping C:/Users/Ryan/AppData/Local/Temp/mini_magick20121024-6068-g2bed8.jpg
I go to the path and the image actually exists, i'm not sure what prevents Carrierwave or MiniMagick from reading it.
Any one has an idea?
Do you have ImageMagick installed? Can you run the identify command manually on the console?
The reason I ask is it appears your error message is what occurs when it can't find the identify commend, which is part of ImageMagick.
I am currently investigating using the selenium-on-rails plug-in for testing an upcoming web app that we are developing.
I've written some tests, and can get them to run successfully in the test runner in the browser, however when I try to run them from the command line using 'rake test:acceptance' I see the following error:
rake aborted!
fork() function is unimplemented on this machine
I have installed the win32-open3 gem and win32-process, neither of these seem to have helped.
Any ideas how I can get this working?
I managed to resolve this by adding the following to the top of acceptance_test_runner.rb:
require 'win32/open3'
require 'win32/process'
However the script was also determining my platform as 'i386-mingw32', which does not match the regexp the script uses to determine if you are on windows /mswin/.
Resolved this second issue by manually specifying
RUBY_PATH=mswin
Phew.
When I upload images I am getting the following error:
[paperclip] An error was received while processing: #<Paperclip::NotIdentifiedByImageMagickError: /tmp/stream20091218-7204-1fuv2j1-0 is not recognized by the 'identify' command.>
I have staging servers that have been setup on VMs that work fine, but once I move out to the production server this is what I get. All servers are running on Archlinux, although the staging servers are on 64bit OS's while the production is an a 32bit.
If I run:
identify -version
I get an error until I add the /usr/local/bin to the PATH, to which I will then see the ImageMagick specs. Unfortunately, altering the PATH doesn't seem to have any effect when uploading files directly to the server.
I have also been unsucessful when setting the location paperlclip looks for the image lib via:
config.after_initialize do
Paperclip.options[:command_path] = '/usr/local/bin/'
end
Any clues on how to configure things to allow imagemagick to process the images?
Thanks for the help.
It turned out that the png and jpeg delegates weren't available when compiling the IM. After downloading and installing the delegates, then re-compiling IM things are now working.