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.
Related
I am succesfully able to convert PDF/DOC/DOCX to PNG using Rmagick gem in Ruby on Rails in my local system.
The algorithm I am following:
1. Fetch the PDF/DOC/DOCX from a given url.
2. Download that PDF/DOC/DOCX file in local project folder temporarily.
download_path_of_document = "#{Rails.root}/path/to/my/local/download_folder"
open("https://my-url.com") do |doc|
File.open(File.join(download_path_of_document, ".#{extension according to file doc/docx/pdf}"), "wb") do |file|
file.write(doc.read)
end
end
3. Pass that file through the RMagick convertor code by mentioning the path of that locally downloaded file.
4. Get it converted to PNG successfully.
my_converted_pngs = Magick::ImageList.new(File.join(download_path_of_document, ".#{extension according to file doc/docx/pdf}"))
5. Delete the downloaded file that was downloaded in step 2.
This method is working absolutely fine in my local system (environment).
But something weird is happening in my staging server.
I am getting an error like : unable to open image `/tmp/magick-14238gTk5-CaYAECT': No such file or directory # error/blob.c/OpenBlob/2712. The weird thing is that I am getting this error only when I pass DOC and DOCX file in step 3; in case of PDF it is working fine.
Kindy please help. (If any doubt regarding questions please ask multiple times in comments)
ruby - 2.2.2
rails - 4.2.2
gem - rmagick
Hey I don't know if this will help, but I had this similar problem which would return the same error. For my use case I was requesting a page which was doing 2 simultaneous process. First process was fetching an image, second process was generating the image that was to be fetched.
I discovered that because rails Puma server is single threaded, my computer would not be able to execute both of these processes at the same time.
What I did is I added another concurrency to Puma.
#puma.rb
#uncomment this line and add a concurrency of 2
workers ENV.fetch("WEB_CONCURRENCY") { 2 }
Now kill rails server.
Next time you run rails server you should be able to see something different. Process workers shouldve been increased to 2.
If you don't see this change try entering bundle exec puma -C config/puma.rb
Hope this was of help.
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
After adding include CarrierWave::MiniMagick to my image_uploader.rb file as well as uncommenting the process: resize to fit => [200,300] line inside of image_uploader.rb, whenever I attempt to create a new Listing in my app I receive the following error message:
"Errno::ENOENT in ListingsController#create" with the explanation of "No such file or directory - identify".
It appears the error is occurring in the directory of 'app/controllers/listings_controller.rb' on line 20 inside the "Create" action.
Description of extracted source on the error page shows this:
self.pid = Process.spawn({'LANG' => self.lang}, command, log_opts)
as the line raising an error.
Prior to these two mentioned changes, the new Listing would be created with no issue whatsoever (apart from the attached image being much too large, hence my newest change). I'm using Cloud9 IDE to develop this application, with Puma as my web server, and Heroku as the (intended) future production-grade app host.
No such file or directory - identify
This is mean that ImageMagick package isn't installed in your OS. So, try to find way to install ImageMagick package to your Heroku node.
Update
This answer says that ImageMagic is installed to Heroku already. So, try to add Ruby wrapper of ImageMagick to your Gemfile:
gem 'mini_magick', '~> 4.1.0'
I am using paperclip + imagemagick but my images are not being correctly uploaded, and when I inspect the element it says: img alt="Missing" src="/images/medium/missing.png"
I have no idea why is it looking for the images on that path.
I am using Ruby 2.0, Rails 4.0 and Windows 7, and given the research I have already done online I understand it can be tricky to get ImageMagick and paperclip properly working on this operating system.
This is what I have already done, nothing seems to be working yet:
Installed paperclip version 3.5.2.
Uninstalled and installed ImageMagick several times (tried static and dynamic versions... x86 and x64 and nothing)
Re-checked all the commands syntax
Added the ImageMagick path on development and production config.
Paperclip.options[:command_path] = 'C:\ImageMagick-6.8.7-Q16'
Created a new rb file on config, initializers, called paperclip with the following:
require "paperclip"
Paperclip.options[:command_path] = 'C:\ImageMagick-6.8.7-Q16'
Paperclip.options[:swallow_stderr] = false
Restarted the pc, restarted the command prompt, restarted rails servers.
Nothing seems to have changed anything, my images still appear as broken links and the error I am getting is the same.
Could you please help me figure it out?
Thanks
A.-
I'm trying to install Mercury editor: http://jejacks0n.github.com/mercury/ in my rails 3.2.1 application.
The problem is, that when the page is loading, and the mercury.js file is in the assets/javascripts it crashes with this message:
Error occurred during initialization of VM
java/lang/NoClassDefFoundError: java/lang/invoke/MethodHandle
(in /home/pawelski/.rvm/gems/ruby-1.9.3-p0/bundler/gems/mercury-8cb7ae599c34/vendor/assets/javascripts/mercury/mercury.js.coffee)
I was looking for reason, and found that requiring mercury/mercury in mercury.js file is the problem. What is wrong? Is the gem not loading correctly?
I tried with an new clean application and the same happened, I guess that it's something wrong in my rails/ruby environment, but where I should start?
Unfortunetly it is something wrong with my lib to compile js with coffee-script.
I changed it to therubyracer, and it works just fine.
Temporary solution for this problem, untill I don't come with another.