首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >ImageMagick,回形针,macOs塞拉利昂

ImageMagick,回形针,macOs塞拉利昂
EN

Stack Overflow用户
提问于 2016-10-04 15:33:04
回答 2查看 448关注 0票数 0

我完全绝望了。我已经尝试安装ImageMagick表单两天,我仍然有问题的纸夹创业板,我的Rails。我正在使用macOS塞拉利昂,我已经通过MacPorts安装了ImageMagick

代码语言:javascript
复制
sudo port install ImageMagick

我检查了安装目录:

代码语言:javascript
复制
which identify

并返回opt/local/bin/标识。

我使用以下方法更改了development.rb:

代码语言:javascript
复制
Paperclip.options[:command_path] = "/opt/local/bin"

当我输入控制台时

代码语言:javascript
复制
port info ImageMagick

我有这个

代码语言:javascript
复制
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:          ryandesign@macports.org

当我创建一个“食谱”时,tehre是一个错误:

215f68293f2d16f1f79bd2e366a45a9620160928-61978-d794or剪纸夹::RecipesController#create中的错误处理缩略图时出错

我的控制器看起来是这样的:

代码语言:javascript
复制
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

型号:

代码语言:javascript
复制
class Recipe < ApplicationRecord
has_attached_file :image, styles: { medium: "400x400#>" }
validates_attachment_content_type :image, content_type: /\Aimage\/.*\z/
end

以及表格:

代码语言:javascript
复制
= 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"

当我在没有选择图像的情况下创建菜谱时,它工作得很好,但是当我选择一个时,我会有一个错误。

我不知道问题出在哪里。我要更新MagickInfo还是.?

EN

回答 2

Stack Overflow用户

发布于 2016-10-26 19:00:39

卸载xz可能会有所帮助。

代码语言:javascript
复制
brew uninstall xz
票数 0
EN

Stack Overflow用户

发布于 2017-05-22 17:54:12

这表明我是多么的愚蠢问题是在Chrome中运行adBlock。它还阻止了Rails中的图像。

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/39856368

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档