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.
Related
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
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.
We're using RMagick (version 2.13.2), along with carrierwave, carrierwave-mongoid, and Rails.
On our testing machine, when you upload an image to create an object, RMagick fails to resize the image.
The error in the log file is:
libgomp: Thread creation failed: Resource temporarily unavailable
This doesn't happen on my development machine strangely enough.
This seems to be a common issue, such as in this post.
I tried setting this environment variable, it didn't help.
Anyone has any tips?
Thanks
I had the same problem with convert in my production server, which is a virtual server and has limited resources. I solved with the environment variable MAGICK_THREAD_LIMIT=1
In ruby, you can solve this with
ENV['MAGICK_THREAD_LIMIT']=1
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.-
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.