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
Related
I'm trying to install Ruby on Rails on Windows 7 but I have a problem immediately at the beginning of the configuration. This is the first time I'm trying RoR.
I downloaded RailsInsaller from http://railsinstaller.org/ and installed it successfully. Immediately after the installation when I need to configure environment, I receive an error in cmd:
# Rails Environment Configuration.
open C:\\Users\\\246ero/.ssh/id_rsa failed: No such file or directory.
The system cannot find the path specified.
D:/ROR/RailsInstaller/scripts/config_check.rb:87:in `initialize': No such file o
r directory - C:\Users\|ero/.ssh/id_rsa.pub (Errno::ENOENT)
from D:/ROR/RailsInstaller/scripts/config_check.rb:87:in `open'
from D:/ROR/RailsInstaller/scripts/config_check.rb:87:in `<main>'
What is the solution to this problem? Or is there any other way to install RoR on Windows 7? Thank you for your help.
I know it's an old post, but I had the same issue, and I think I've found the solution.
The path that ssh is trying to access contains that character "|" that Ruby doesn't like, that's because your username is "|ero".
To resolve this issue, you should either change your windows username (this should prevent you from a lot of troubles in your future setup), or change your HOME environment variable so that it points to a folder that doesn't contain any accent, space or strange character in its path ! And then re-install Ruby :)
Hope it helps!
I have installed Ruby on Rails in Windows 7. To install ruby on rails on Windows7 follow the steps:
1) install ruby on windows 7. Download from: http://rubyinstaller.org/
2) check ruby is installed correctly by this command ruby -v if this gives command not found error, then set RUBY_HOME="path/to/ruby/bin" in environment variables.
3) install rails by command gem install rails.
and you are done. Enjoy Ruby On Rails on Windows7.
I faced exactly the same problem and found its solution - under Windows XP Pro SP3. You should manually generate the ssh keys pair. Run ssh-keygen from a bash
shell so it generated both id_rsa and id_rsa.pub.
That's easy as 3 mouseclicks:
Start - Programs - Rails Installer - Git Bash
type there "ssh-keygen". Press Enter 2 or 3 times. You're done! The problem is gone now.
I have problem with rmagick in Rails 3.
Everything seems to be installed, but I get the following error:
Failed to manipulate with rmagick, maybe it is not an image? Original
Error: unable to open image
`kar/public/uploads/tmp/20110825-1348-30304-9150/thumb_1314198312_by_jannnu11_500.jpg':
# error/blob.c/OpenBlob/2588
File exists. Have good chmod.
This code works on another server.
Any ideas?
In some cases the installation of ImageMagick may have missed some of the file formats required for the image manipulation you are trying to do on that machine.
Try to run identify -list format and see what you are missing from there.
If it turns out that you are just missing the file format, try to uninstall/reinstall and you should be good to go.
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"
I've been searching on how to solve this issue but could not find any real and working solution.
User model:
validates_attachment_content_type :avatar, :content_type => ['image/jpeg', 'image/pjpeg', 'image/x-png', 'image/png', 'image/gif']
Unnecessary error shows up when invalid file type is uploaded:
Avatar /tmp/sample,23283,0.txt is not recognized by the 'identify' command.
Server details:
Ubuntu and Debian
which identify
results to
/usr/bin/identify
Specifying command path does not solve the issue:
Paperclip.options[:command_path] = "/usr/bin"
Any ideas?
I looked at geometry.rb file and there seems to be something wrong with it.
def self.from_file file
file = file.path if file.respond_to? "path"
geometry = begin
Paperclip.run("identify", %Q[-format "%wx%h" "#{file}"[0]])
rescue PaperclipCommandLineError
""
end
parse(geometry) ||
raise(NotIdentifiedByImageMagickError.new("#{file} is not recognized by the 'identify' command."))
end
Let me know if anyone has solved the same issue and how. Many thanks.
I've had the same problem - the Paperclip code is not at fault.
In my setup I'm on MacOSX with a binary download of ImageMagick in /usr/local/ImageMagick-6.6.1/bin and I'm running Rails under Apache/Passenger. I've got Paperclip installed as a plugin.
There are 3 steps needed to get this working:
1: Make sure you have ImageMagick working at the UNIX command line level. This involves adding it to your path and exporting these environment variables (pointing to your ImageMagick installation, of course)
MAGICK_HOME=/usr/local/ImageMagick-6.6.1
DYLD_LIBRARY_PATH=/usr/local/ImageMagick-6.6.1/lib
Check that identify works with your images at the command line level.
2: Tell Paperclip where to find the ImageMagick executables
In config/environment.rb add this at the bottom of the file
Paperclip.options[:command_path] = "/usr/local/ImageMagick-6.6.1/bin"
At this point, after restarting Passenger, you would see that 'identify' is run from within Paperclip but is not able to identify the file... the final step is...
3: Identify needs those two exported environment variables - and Apache/Passenger (or other web servers probably) does not pass those through by default!
In your passenger vhost file add these lines:
SetEnv MAGICK_HOME /usr/local/ImageMagick-6.6.1
SetEnv DYLD_LIBRARY_PATH /usr/local/ImageMagick-6.6.1/lib
Restart apache/passenger and it should work
Good Luck!
You should have imagemagick installed which provides the identify command, and its path has to be in the $PATH variable of the user rails is running as.
It is used by paperclip for the scale and image manipulation options, but it is not documented as dependency because you "can" use paperclip without it if you accept the images as they come.
I hope it helps.
http://github.com/thoughtbot/paperclip/issues/issue/167
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/ ?