Topic: Paperclip plugin can't save my thumbnails due to my routes?

Hi,
i wanted to try out Paperclip so i followed this tutorial: [url=http://jimneath.org/2008/04/17/paperclip-attaching-files-in-rails/]Jim Neath

Re: Paperclip plugin can't save my thumbnails due to my routes?

Does anyone see what i'm doing wrong here?

if not, could someone link me to a tutorial or a screencast where Paperclip works fine?

Thanks.

Re: Paperclip plugin can't save my thumbnails due to my routes?

It doesn't look like a route problem.  Do you have ImageMagick installed?

Re: Paperclip plugin can't save my thumbnails due to my routes?

ericc59 wrote:

It doesn't look like a route problem.  Do you have ImageMagick installed?

yeah it does. i compiled it in and tested it. i've used attachment_fu along with rmagick succcessfully.


any idea what it is? this thing is driving me crazy smile

thanks.

Re: Paperclip plugin can't save my thumbnails due to my routes?

ericc59, it turns out you were right.

i installed ImageMagick myself and configured and tested it and it worked fine...but somehow, it stopped working. Turns out some environment variables had been reset...i'm not sure how this happenned since I haven't even logged out or rebooted the machine in the last month.

Anyway, I just re-set the environment variables in my /etc/environment and things are back to normal.

Thanks for bringing ImageMagick to my attention.

Re: Paperclip plugin can't save my thumbnails due to my routes?

I see to be suffering from the same issue, except its only when trying to run my app under passenger. If its running under mongrel as my user account it fine.

I believe it might be a permissions issue since the stream seems to be created with user only perms:

/tmp> ls -alt stream.*
-rw-------  1 corey  wheel  195805  3 Jul 13:41 stream.717.0

Anyone know how to change the runner account for passenger?

Re: Paperclip plugin can't save my thumbnails due to my routes?

it's also possible that the account passenger is running under can't see the imagemagick .so files.

you can fix this using ldconfig if you know how. let me know if you need some help with this.

sorry i can't help you out with passenger, not too familiar with it, myself.

good luck.

Re: Paperclip plugin can't save my thumbnails due to my routes?

Don't muck with environment variables. The solution is this:

# config/initializers/paperclip.rb
Paperclip.options[:image_magick_path] = "/usr/local/bin"

Re: Paperclip plugin can't save my thumbnails due to my routes?

@avit: thanks very much. your solution worked perfectly.

Re: Paperclip plugin can't save my thumbnails due to my routes?

hy sorry for bringing this old thread back on top...

but i have also the problem with creating thumbs...

i get always this error message
Photo C:/DOKUME~1/Nibblas/LOKALE~1/Temp/stream.1052.1 is not recognized by the 'identify' command.

image_magick ist installed. rmagick too

in application_controller i have  require 'rubygems'
require 'RMagick'.

the path to image magick in paperclip.rb is set to  :image_magick_path => "C:\Programme\ImageMagick-6.4.5-Q16"


user model

has_attached_file :photo, :whiny_thumbnails => true,
    :styles => {
      :thumb=> "100x100#",
     :small  => "150x150>" }

any idea?

Re: Paperclip plugin can't save my thumbnails due to my routes?

same problem for me... can anyone help?
I have tried ll of the above options, reinstalled ImageMagick from source in usr/local/bin and still getting the not recognized by 'identify' command

Re: Paperclip plugin can't save my thumbnails due to my routes?

sorted this. it was my mac, I hadn;t installed imagemagick properly!

Re: Paperclip plugin can't save my thumbnails due to my routes?

For some cases (like mine 1/2 hour ago) even with the imagemagick installed, the paperclip fails silently(nothing about not finding imagemagick related binaries in logs) when running in passenger. (and posting here as it's the first result in google tongue)

I installed ImageMagick using macports, and so I proceeded to test paperclip to generate some thumbnails with the :styles, and no results, just the original popping with the original resolution, even with model indicating to resize the original.
So I've been searching all over the internet and lots of try and errors.

But a lot of them involved setting a different directory to the IM binaries, making new directories with the binaries, and so on.. No results. But I remembered to have seem some problems about permissions using passenger (mod_rails) and commands.

So I remembered I didn't thought about the real path to the IM installed by macports... *self slaps* As to the extent I've checked, nobody told anything, just "Oh, install imagemagick"... Well, with the permissions issue with passenger, it becomes a little deeper...

Then... How to make paperclip work with imagemagick installed by macports in a passenger driven server:

1. Go to terminal and "sudo port install ImageMagick"
2. After macports says done, type "which Magick-config" and see what's the real path to the command.
3. Create a paperclip.rb file in initializers dir (:rails_root/config/intializers) of your project and write "Paperclip.options[:image_magick_path] = "<imagemagick_path>"" (as <imagemagick> being the information given by the command of the last step without the command. e.g : /opt/local/bin/) and save.
4. Restart server (just being paranoid here tongue).

At least this solved in my case.

Re: Paperclip plugin can't save my thumbnails due to my routes?

Oh yes indeed, thanks a lot avit!

Re: Paperclip plugin can't save my thumbnails due to my routes?

Avit's solution worked for me as well on my Mac. However, to avoid environment errors (since I'm developing on a Mac but deploying to production on Solaris) I put the Paperclip.options line in config/environments/development.rb

I haven't deployed to Solaris yet, but if I run into path issues there I can put the line in production.rb.

Re: Paperclip plugin can't save my thumbnails due to my routes?

Paperclip.options[:image_magick_path] will be deprecated, use :command_path instead.

Re: Paperclip plugin can't save my thumbnails due to my routes?

After one entire day I found the answer right here, thanks to cprophony and avit!!

Re: Paperclip plugin can't save my thumbnails due to my routes?

Johnson wrote:

Paperclip.options[:image_magick_path] will be deprecated, use :command_path instead.

So correct settings are then:

# config/initializers/paperclip.rb
Paperclip.options[:command_path] = "/usr/local/bin"

Re: Paperclip plugin can't save my thumbnails due to my routes?

Just had the same problem. Having compiled and installed the version on the website this would not work, installed using mac ports, included the initializer as above, it works.

Re: Paperclip plugin can't save my thumbnails due to my routes?

I had the same experience as mark_d. I installed ImageMagick per the ImageMagick's web site on my Mac Book Pro, and could not get it to work. I then removed it, installed ImageMagick via MacPorts, added the initializer described previously, and presto! - it worked.