3

初めて Spree をセットアップしようとしています。画像のアップロードに到達するまで、すべてが順調に進んでいました。Mac OSX Mountain Lion に自作を使用して Imageamgick をインストールしました。画像をアップロードすると、次のエラーが表示されます。

Paperclip::NotIdentifiedByImageMagickError in Spree::Admin::ImagesController#create

    Command :: identify -format %wx%h :file
[paperclip] An error was received while processing: #<Paperclip::NotIdentifiedByImageMagickError: /var/folders/fq/9g_6hmg513g6137rb6sbghw00000gn/T/stream20121005-26943-16883d4.png is not recognized by the 'identify' command.>

Paperclip::NotIdentifiedByImageMagickError (/var/folders/fq/9g_6hmg513g6137rb6sbghw00000gn/T/stream20121005-26943-16883d4.png is not recognized by the 'identify' command.):
  paperclip (2.7.1) lib/paperclip/geometry.rb:29:in `from_file'
  spree_core (1.2.0) app/models/spree/image.rb:35:in `find_dimensions'
  activesupport (3.2.8) lib/active_support/callbacks.rb:405:in `_run__1794851703999987262__post_process__1580526166879208018__callbacks'

コマンドラインからidentifyを実行すると、次の出力が得られます

    Image Settings:
  -alpha option        on, activate, off, deactivate, set, opaque, copy
                       transparent, extract, background, or shape
  -antialias           remove pixel-aliasing
  -authenticate password
                       decipher image with this password
  -channel type        apply option to select image channels
  -colorspace type     alternate image colorspace
  -crop geometry       cut out a rectangular region of the image
  -define format:option
                       define one or more image format options
  -density geometry    horizontal and vertical density of the image
  -depth value         image depth
  -extract geometry    extract area from image
  -features distance   display image features (e.g. contrast, correlation)
  -format "string"     output formatted image characteristics
  -fuzz distance       colors within this distance are considered equal
  -gamma value         of gamma correction
  -interlace type      type of image interlacing scheme
  -interpolate method  pixel color interpolation method
  -limit type value    pixel cache resource limit
  -monitor             monitor progress
  -ping                efficiently determine image attributes
  -quiet               suppress all warning messages
  -regard-warnings     pay attention to warning messages
  -respect-parentheses settings remain in effect until parenthesis boundary
  -sampling-factor geometry
                       horizontal and vertical sampling factor
  -seed value          seed a new sequence of pseudo-random numbers
  -set attribute value set an image attribute
  -size geometry       width and height of image
  -strip               strip image of all profiles and comments
  -unique              display the number of unique colors in the image
  -units type          the units of image resolution
  -verbose             print detailed information about the image
  -virtual-pixel method
                       virtual pixel access method

Image Operators:
  -negate              replace every pixel with its complementary color 

Miscellaneous Options:
  -debug events        display copious debugging information
  -help                print program options
  -list type           print a list of supported option arguments
  -log format          format of debugging information
  -version             print version information

By default, the image format of `file' is determined by its magic
number.  To specify a particular image format, precede the filename
with an image format name and a colon (i.e. ps:image) or specify the
image type as the filename suffix (i.e. image.ps).  Specify 'file' as
'-' for standard input or output.

どんな助けでも大歓迎です。

ありがとう、コーリー

4

3 に答える 3

12

私のエラーは - 「<strong>Spree::Admin::ImagesController の Paperclip::NotIdentifiedByImageMagickError」</p> でした。

数日前にこのエラーを修正しました。

その前に私は試しました:

  • XCode の更新 (コマンドライン ツールを使用)
  • Imagemagickを更新します(ソースからバイナリモジュールとして試しました)
  • MacPort を更新する
  • MacPort ではなく、Brew を使用 (Imagemagic のすべての依存関係で更新、「brew doctor」を使用)
  • Imagemagick を使用するすべての gem を再インストールします
  • バンドルの更新

確かに、Production.rb ファイルに Imagemagick の bin フォルダーを指す「Paperclip::Attachment.default_options[:command_path]」オプションがありました。

何度か、a から z まで、何度も繰り返しました。

しかし、何も私を助けることができませんでした。

ちなみに、すべての場合で、あらゆる種類のテスト画像で「変換」、「識別」、および「表示」はうまくいきましたが、私のレールアプリ(スプリーアプリ)ではうまくいきませんでした。

私はひしゃくに飛び込み、レールコンソール内で調査を試みました

Paperclip.run("identify", "-format %m :file", :file => "/path/to/image”) 

ペーパークリップのように。そして、このコマンドの新しい形式 (コカイン 0.4) のみ:

Paperclip.run("identify", "-format %m /path/to/image")

うまくいきました!!!

その結果、コカイン 0.4 が私の問題の原因であることがわかりました。Gemfile でコカイン 0.3.2 にダウングレードしようとしたところ、Spree アプリが動作し始めました!!!

私がする必要があるのは、コカイン0.4の代わりに0.3.2を使用することだけです!!!

于 2012-10-07T18:44:16.853 に答える
0

また、パブリックフォルダーに画像ファイルが存在しない場合にも問題が発生しました。同じ名前
のランダムなファイルをコピーしたところ、すべてが機能し始めました。

parepclip 2.7.5 cocain 0.3.2
于 2013-08-29T05:37:04.620 に答える
0

png 形式が識別のコンパイル済み形式のリストにあるかどうかを確認します。

identify -list format

そうでない場合は、次のオプションを使用して再コンパイルする必要があります。

./configure --prefix=/usr/local --with-bzlib=yes --with-fontconfig=yes --with-freetype=yes --with-gslib=yes --with-gvc=yes --with-jpeg=yes --with-jp2=yes --with-png=yes --with-tiff=yes
于 2012-10-05T19:57:28.450 に答える