Ruby on Rails,Paperclip:“识别”命令在cmd中工作但不在app中工作 [英] Ruby on Rails, Paperclip: "identify" command working in cmd but not in app

查看:147
本文介绍了Ruby on Rails,Paperclip:“识别”命令在cmd中工作但不在app中工作的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在Windows 7 64bit上安装了ImageMagick,我有Paperclip Gem。我的用户模型如下所示:

I've installed ImageMagick on my Windows 7 64bit and I have the Paperclip Gem. My User model looks like this:

   class User < ActiveRecord::Base
  # Paperclip
  has_attached_file :photo,
    :styles => {
      :thumb=> "100x100#",
      :small  => "150x150>" }
  end

在paperclip.rb和development.rb中我有:

In paperclip.rb and development.rb I have:

Paperclip.options[:command_path] = 'C:/Program Files/ImageMagick-6.6.7-Q16'

我的_form看起来像这样:

My _form looks like this:

    <%= form_for(@user, :html => { :multipart => true } )  do |f| %>
  <% if @user.errors.any? %>
    <div id="error_explanation">
      <h2><%= pluralize(@user.errors.count, "error") %> prohibited this user from being saved:</h2>

      <ul>
      <% @user.errors.full_messages.each do |msg| %>
        <li><%= msg %></li>
      <% end %>
      </ul>
    </div>
  <% end %>

  <div class="field">
    <%= f.label :username %><br />
    <%= f.text_field :username %>
  </div>
  <div class="field">
    <%= f.label :name %><br />
    <%= f.text_field :name %>
  </div>
  <div class="field">
    <%= f.label :email %><br />
    <%= f.text_field :email %>
  </div>
  <div class="field">
    <%= f.label :crypted_password %><br />
    <%= f.text_field :crypted_password %>
  </div>
  <div class="field">
    <%= f.label :password_salt %><br />
    <%= f.text_field :password_salt %>
  </div>
 <%= f.file_field :photo%>
  <div class="actions">
    <%= f.submit %>
  </div>

<% end %>

enter code here

上传时出现以下错误图像:

I'm getting the following error when uploading an image:

[paperclip] An error was received while processing: #<Paperclip::NotIdentifiedByImageMagickError: C:/Users/John/AppData/Local/Temp/stream20110212-6576-1us1cdl.png is not recognized by the 'identify' command.>  

我可以在我的cmd中使用该图像上的识别,并返回有关图像的元数据问题。

I'm able to use identify in my cmd on that image and it returns metadata about the image without problems.

如果可以,请提供帮助。我已经被困在这一个问题上超过一天了。

Please help if you can. I've been stuck on this one issue for over a day now.

推荐答案

在development.rb中更新了以下内容并开始工作

Updated the following in development.rb and it started working

Paperclip.options[:command_path] = 'C:/Progra~1/ImageM~1.8-q'

这是在Windows 2008 32位服务器上

This was on a Windows 2008 32 Bit Server

这篇关于Ruby on Rails,Paperclip:“识别”命令在cmd中工作但不在app中工作的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆