Links
Attachment Fu
Categories
Attachment Fu
attachment_fu is a plugin by Rick Olson (aka technoweenie) and is the successor to acts_as_attachment. To get a basic run-through of its capabilities, check out Mike Clark’s tutorial http://clarkware.com/cgi/blosxom/2007/02/24#FileUploadFu.
Vitals
| Repository | git://github.com/technoweenie/attachment_fu.git |
|---|---|
| License | Rails' (MIT) |
| Tags |
attachment file hdfh image nilesh nileshKul paginator resize thumbnails upload upload uyuyu vvcb yuyuytu
|
| Rating | (112 votes) |
| Owner | Rick Olson |
| Created | 19 February 2007 |
Comments
-
What's the motivation behind the re-write?
-
Note: Only allows 1 attachment per model (as of june 2007). I'm 'bout to hack myself an attachment_fufu...
-
I was unable to get the Amazon S3 backend to work properly (in Rails 2).
-
If you want more than one attachment per model check out the file_column plugin. It doesn't have S3 support but it allows you to treat a file as just another column type in your database.
-
using the callback:
after_resize do |record, img| record.size = img.filesize endused to work fine with rails 1.2.6
but I upgraded to 2.1 and get the error message: The error occurred while evaluating nil.filesize
Then I applied the patch from: http://blog.methodmissing.com/2008/1/19/edge-callback-refactorings-attachment_fu/
On the bottom of attachment_fu.rb and I got the error message: undefined method `run' for ActiveSupport::Callbacks::Callback:Class
Please, I need help to fix this.
Thank you.
-
I've been using this plugin with great success but the default error messages suck...
-
Pablo - I've got the same problem; can't try it myself yet, but I see Rick Olsen has updated attach_fu back in march for Rails 2.x - he credits methodmissing, but his changes are different (and after all the methodmissing changes are for edge rails not plain vanilla shipping rails).
That's what I'll be trying next: updating the plugin from techo-weenie.
-
Having a problem using Attachment Fu with Single Table Inheritance. Seems like they don't get along too well... keep getting an error "undefined method for "attachment_options". This occurs when calling .public_filename on a model object (ie: content.image.public_filename). Works the first time, but all subsequent attempts result in the error.
-
I have the same problem as Pablo. Any chance someone can update the plugin. I have looked in the code but i think i am not good enough to find a solution... :(
I just downgraded to 2.0.2...
-
From Windows, saving to the DB requires some tweaking. See http://epirsch.blogspot.com/2008/01/fixing-attachmentfu-on-windows-like.html
(The problem was that saving to the DB was not working. Partial info was saved)
-
Hi Piers and jm. Just encountered the same problem and found the following patch which with a small amend works on 2.1... http://blog.methodmissing.com/
Here is the full patch for attribute_fu.rb...
def callback_with_args(method, arg = self) notify(method) result = run_callbacks(method, { :object => arg }) { |result, object| result == false } if result != false && respond_to_without_attributes?(method) result = send(method) end return result end def run_callbacks(kind, options = {}, &block) options.reverse_merge!( :object => self )ActiveSupport::Callbacks.run(self.class.send("#{kind}_callback_chain"), options[:object], options, &block)
self.class.send("#{kind}_callback_chain").run(options[:object], options, &block) end -
Hi Rick,
Love the plugin. Couldn't find a place to submit this bug report, but I get this in my mongrel log file about once a month:
image_science_processor.rb:14: [BUG] Segmentation fault
If anyone has any info on this please drop me a line. I have FreeImage 3.9 installed on Ubuntu. Brian
-
It looks like this attachment_fu doesn't work with an Oracle DB, because 'size' is a special keyword. This could be handled at the DDL layer by outputing "size" in all the SQL, or by changing this plugin's convention to, say, dimension(s). Alas.
-
I can't understand why I can't upload a file even if its size is OK; I just added to my model:
has_attachment :max_size => 10.megabytes
validates_as_attachment. I tried to upload a file of 2.8 Mb, when debugging its size waz at 0; WHY????? -
If you don't need the size attribute and are using Oracle (ie - not storing images), then do NOT put the size attribute in the table, and instead fake it in the model with 'attr_accessor :size'
That hack saved a lot of time for our dev team.
-
It's a greatest plugin. Resizing image and creating thumbnails are very easy. simply amazing.
But if i use the "validates_as_attachment" in model it gives the following error "size is not included in the list". If i eliminate this line from model it works fine in all aspects.
-
Is it possible to make the :s3_access conditional based on a user input when creating the object. I would like the user to be able if to select if the attachment is authenticated-read or public-read. Is this possible and how would you setup the conditional statement?
-
Great plugin. Works very nicely.

