开发者

Mongoid Paperclip won't upload

https://gist.github.com/867324246b1f77b555b9

It seems like everything is getting passed in correctly, and it's all stored in the db as well, but it doesn't actually upload or make any directories in th开发者_如何学Ce file system.


I had all sorts of issues with Paperclip silently failing when the image conversion or file system access fails. So, if you are using the thumbnail creation features, make sure your ImageMagick installation is good:

$: which convert
/usr/local/bin/convert
$: which identify
/usr/local/bin/identify

Or, if your ImageMagick installation is in an abnormal directory, set the command path option on Paperclip.

Paperclip.options[:command_path] = "/usr/local/ImageMagick-6.6.1/bin"

You may also have to set some environment variables in your shell and webserver config. All the info about this can be found in this tutorial: Craic Computing Paperclip and Imagemagick.

Also make sure the directories in which you store images exist and are writable by your server process.

Hope this helps!


If you're using Mongo, you should look at GridFS. This way, you can store your files directly in your database. Paperclip supports this in a fork.


Make sure that your Model has

include Mongoid::Document
include Mongoid::Paperclip

has_mongoid_attached_file :avatar

attr_accessible :avatar

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜