Koen's blog Profile Photo

Koen's blog

Ik typ. Ik typ voor mijn Sien, Arwen, Mila en Nienke.

Phusion Passenger and Paperclip

“Paperclip?”:thoughtbot.com/projects/…

bq. Paperclip is a plugin for Ruby on Rails’ ActiveRecord that lets files work as simply as any other attributes do.

“Phusion Passenger?”:www.modrails.com

bq. Phusion Passenger™ — a.k.a. mod_rails or mod_rack — makes deployment of Ruby web applications, such as those built on the revolutionary Ruby on Rails web framework, a breeze.

Probleem

Wanneer je de “Paperclip”:thoughtbot.com/projects/… “rails”:rubyonrails.org plugin gebruikt in combinatie met “Passenger”:www.modrails.com zou je wel eens tegen het volgende kunnen aanlopen (in de log na een upload):

@[paperclip] /tmp/stream.1082.0 is not recognized by the ‘identify’ command.@

Terwijl het met “mongrel”:mongrel.rubyforge.org perfect werkt.

Op het eerste zicht lijkt het iets met de tempfile te zijn, geen permisies ofzo. Niets is minder waar, na wat testen en surfen/zoeken blijkt het “gewoonweg het ImageMagick path”:www.fuzzylizard.com/archives/… te zijn.

Oplossing

Voeg volgende initializer toe:

<% coderay :lang => ‘ruby’, :line_numbers => ‘inline’ do -%> if RAILS_ENV == “development” Paperclip.options[:image_magick_path] = “/opt/local/bin” end <% end -%>

Hier werkt het. Nu daar nog. ;)