Paperclip - helppppp

I keep seeing this error when I try to upload an image:

2 errors prohibited this panel from being saved

There were problems with the following fields:

Image C:/Users/Family/AppData/Local/Temp/stream,10032,0.png is not
recognized by the ‘identify’ command.
Image C:/Users/Family/AppData/Local/Temp/stream,10032,0.png is not
recognized by the ‘identify’ command.

If I have my model Panel (which needs an image attachment) look like
this, with the ‘whiny’ option set to false…

class Panel < ActiveRecord::Base
belongs_to :section

has_attached_file :image, :styles => { :medium => “300x300>”,:thumb
=> “100x100>” }, :whiny => false

validates_attachment_content_type :image, :content_type=>[‘image/
jpeg’, ‘image/jpg’, ‘image/png’, ‘image/gif’],
:message => ‘can only be jpeg, jpg, png, or gif’,
:unless => { |photo| photo[:image].nil? }


…then I can upload an image. BUT I find that the following doesn’t

<%= image_tag panel.image.url(:medium) %>
<%= image_tag panel.image.url(:thumb) %>

…while the regular, <%= image_tag panel.image.url %> works fine. I
have a feeling that the reason these two don’t work is somehow tied to
my first problem, when :whiny was not set to false. Maybe the first
error might somehow be responsible for the directory not getting made
for the :medium and :thumb…each images in the ‘systems/images’
directory only has ‘original’ - no ‘thumb’ or ‘medium.’
But I don’t know! All I know is that the directory for thumb and
medium don’t get made, so those 2 lines of code won’t work!

Please helppp…this has been very frustrating…

If you’re getting the original image then you have ImageMagic setup

On Windows there is a bug in the current paperclip gem where the
ImageMagick arguments are surrounded by single quotes, which windows
doesn’t like.

Take a look at the console output to see the errors, try the commands
that paperclip log outputs. If you have the single quote problem then
update the paperclip.rb file:
def quote_command_options(*options) do |option|
option.split("’").map{|m| “#{m}” }.join("\’") #removed single
quotes around #{m}

Also note that in current version of ImageMagic the size in the styles
hash no longer takes a final character, only the dimensions. So if you
have :medium =>‘300x300>’, it now has to be just ‘300x300’

Hope this helps

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs