2016-10-04 33 views
0

Ich bin total verzweifelt. Ich habe versucht, ImageMagick Formular zwei Tage zu installieren, und ich habe immer noch Probleme mit Paperclip gem i Rails. Ich verwende macOS Sierra und ich habe die ImageMagick durch MacPorts installiertImageMagick, Büroklammer, MacOs Sierra

sudo port install ImageMagick 

ich das Installationsverzeichnis überprüft haben:

which identify 

und es zurück opt/local/bin/identifizieren

ich habe die development.rb Verwendung geändert:

Paperclip.options[:command_path] = "/opt/local/bin" 

, wenn ich in eingegeben haben die Konsole

port info ImageMagick 

Ich habe diese

ImageMagick @6.9.5-10 (graphics, devel) 
Variants:    graphviz, lqr, pango, rsvg, universal, wmf, 
[+]x11 

Description:   ImageMagick is a robust collection of tools and 
libraries 
        to create, edit and compose bitmap images in a wide 
        variety of formats. You can crop, resize, rotate, sharpen, 
        color reduce or add effects or text or straight or curved 
        lines to an image or image sequence and save your 
        completed work in the same or differing image format. You 
        can even create images from scratch. Image processing 
        operations are available from the command line as well as 
        through C, Ch, C++, Java, Perl, PHP, Python, Ruby and 
        Tcl/Tk programming interfaces. Over 90 image formats are 
        supported, including GIF, JPEG, JPEG 2000, PNG, PDF, 
        PhotoCD and TIFF. 
Homepage:    http://www.imagemagick.org/ 

Extract Dependencies: xz 
Build Dependencies: autoconf, automake, libtool 
Library Dependencies: bzip2, djvulibre, xz, jbigkit, jpeg, lcms2, 
libpng, tiff, 
        webp, zlib, fftw-3, freetype, fontconfig, 
ghostscript, 
        libiconv, libtool, openjpeg, openexr, expat, libxml2, 
        pkgconfig, xorg-libX11, xorg-libXext, xorg-libXt 
Runtime Dependencies: urw-fonts 
Platforms:   darwin 
License:    Apache-2 
Maintainers:   [email protected] 

Wenn ich ein "Rezept" tehre ein Fehler erstellen ist:

Büroklammer :: Fehler in RecipesController # create Es gab einen Fehler Verarbeitung die Miniaturansicht für 215f68293f2d16f1f79bd2e366a45a9620160928-61978-d794oder

Mein Controller Loo ks wie folgt aus:

class RecipesController < ApplicationController 
before_action :find_recipe, only: [:show, :edit, :update, :destroy] 
def index 
    @recipe = Recipe.all.order("created_at DESC") 
end 

def new 
    @recipe = Recipe.new 
end 

def show 
end 

def create 
    @recipe = Recipe.new(recipe_params) 
    if @recipe.save 
     redirect_to @recipe, notice: 'Succesfully created new recipe' 
    else 
     render 'new' 
    end 
end 

def edit 
end 

def update 
    if @recipe.update(recipe_params) 
     redirect_to @recipe 
    else 
     render 'edit' 
    end 
end 

def destroy 
    @recipe.destroy 
    redirect_to root_path, notice: "Succesfully deleted" 
end 

private 

def recipe_params 
    params.require(:recipe).permit(:title, :description, :image) 
end 

def find_recipe 
    @recipe = Recipe.find(params[:id]) 
end 
end 

Modell:

class Recipe < ApplicationRecord 
has_attached_file :image, styles: { medium: "400x400#>" } 
validates_attachment_content_type :image, content_type: /\Aimage\/.*\z/ 
end 

und die Form:

= simple_form_for @recipe, html: { multipart: true } do |f| 
- if @recipe.errors.any? 
    #errors 
     %p 
      = @recipe.errors.count 
      Prevented this recipe froms saving 
     %ul 
      - @recipe.errors.full_messages.each do |msg| 
       %li= msg 
.panel-body 
    = f.input :title, input_html: { class: 'form-control' } 
    = f.input :description, input_html: { class: 'form-control' } 
    = f.input :image, input_html: { class: 'form-control' } 

= f.button :submit, class: "btn btn-primary" 

Wenn ich schaffen das Rezept ohne das Bild zu wählen, es funktioniert, aber wenn ich ein ich wählen habe einen Fehler.

Ich weiß nicht, wo das Problem ist. Soll ich die MagickInfo aktualisieren oder ...?

Antwort

0

Es könnte sein, Hilfe zu deinstallieren xz

brew uninstall xz 
0

Dies zeigt, wie dumm ich bin. Das Problem bestand darin, dass adBlock in Chrome ausgeführt wurde. Es blockierte auch Bilder in Rails.