Attachment_fu updated!
Written by matt on November 28th, 2007
I recently bugged Rick Olson so much about attachment_fu that he gave me SVN access to fix few bugs.
Rick being really busy with ActiveReload he didn't spend too much time maintaining attachment_fu.
On my side of things, I've been using attachment_fu on a lot of projects and I've been fixing bugs and adding new features.
My first contribution to attachment_fu is a fix for the ImageScience processor.
Attachment_fu is very flexible and let you use your favorite image processor:
- RMagick based on ImageMagick and GraphicsMagick(known to leak memory and being a pain to setup)
- minimagick based on ImageMagick
- ImageScience based on FreeImage.
Like many rubyists, I like ImageScience for its simplicity and efficiency. However, attachment_fu had few problems when being used with ImageScience.
- File sizes for thumbnails were not saved correctly in the database. Fixed
- Thumbnails based on a gif files were not processed properly. So, this was the big problem. FreeImage has issues dealing with resizing gif files because of the gif palette limitation (256 colors). to avoid this problem thumbnails of gif files are converted to png. However the thumbnail content type info in the database was not saved properly. That's now fixed.
- Because of the gif bug reported above, any thumbnail link was broken since it was trying to link to the thumbnail version with a gif extension instead of a png one. Fixed
I also fixed a small bug related to S3 storage and the fact that a_fu had issues loading the config file. (Fixed)
I'll also try be able to add some of the S3 features I've been working on. As well as maybe enhancing the validation process.
In the mean time, you might want to read this blog post about better validation with attachment_fu.
If you are heavily using attachment_fu or starting using it and think that a google group would be great idea, please let me know in the comment and I'll try to convince Technoweenie that we need to set that up :)
Ooohh I almost forgot, if you fixed some bugs you found while using afu, please contact me so we can get afu bug free.
Comments
-
Thank you, thank you! A Google group would be great along with some extra tutorials.
-
Awesome, Matt! I also think a google group would be a big benefit.
I reckon, one of the first things most people using RMagick hack in attachmentfu is the resizeimage method to allow it to properly crop & resize versions; I really can't think of any reason why cropping this way isn't the out of the box behavior.
http://pastie.caboo.se/123053
-
Thanks Matt, I'm looking forward to upgrading. Do any of the current or future S3 mods happen to reduce the occurrence of EOF errors? (google search on "s3 eoferror")
-
Yes, cropping while resizing was a fix that I had to make also to attachment-fu back a while ago. Thanks for getting on this and cleaning it up.
-
Did you fix S3 storage EOF issues? My fix is to retry exception 2-3 times every time you use S3Object: begin S3Object..... rescue EOFError retry end
-
@Joe I'm not aware of this problem.
New google group setup: http://groups.google.com/group/attachment_fu/ feel free to join.
-
Wow. Great job! I use attachment_fu on several projects and seem to have bug fixes spread out all over for it. The group thing is a great idea and I'd definitely help out with supporting it.
-
Matt,
Thanks for making a great plugin even better. We are looking forward to seeing what other enhancements you have in store.
Robert
-
Joe, I think the fix for that is to make it so the S3 connection is not persistent. I'm pretty sure I read somewhere that Marcel Molina who wrote the aws::s3 gem afu uses said that was the issue and the fix is to add :persistent => false in the Base.establishconnection! method of s3_backend.rb
-
I'm currently getting errors when trying to connect to a bucket in EU. But as far as I know that problem has nothing to do with the plugin itself. Awesome, Matt!
-
Hi there... did and posted some fixes to a_fu, based on some of Tim's stuff, and still get a fair bit of traffic, so if you can roll in the changes if you haven't already...
http://www.deepcalm.com/writing/cropped-thumbnails-in-attachment_fu-using-imagescience
-
Hi all, it is the first time I've used afu and met a problem with it. I need your help. My problem is afu can't save thumbnails. the image process I used is RMagick. anyone meet this problem. please show me how to solve it. thanks you very much
-
hi matt
i'm using attachement_fu with rmagick and have a problem. thumbnails can't generate!!
i'm using in model:
class Photo < ActiveRecord::Base hasattachment :contenttype => :image, :storage => :file_system, :max_size => 300.kilobytes, :processor => 'Rmagick', :thumbnails => { :thumb => '100x100>', :full => '200x200' }
validates_as_attachment end
when i uploaded a image, this is saved, but the thumbnail dont is generated. in the database only a new record is created. the thumbnail row is dont generated.
in my view:
linkto imagetag(photo.publicfilename(:thumb)), photo.publicfilename
returns a correct link for file, but a broken image
any sugestion?
-
@leornardo I believe I saw your message on the forum. I believe you also fixed your problem. (migration related)
-
I had been using afu for the past 3-4 months without any problems. But then one of my system administrators did a gem update on the server and after that my afu isnt working. It just crashes the server. There are no errors shown in the logs either. Is it due to some gem update thats causing this issue. I have a bunch of applications in production mode that uses afu. Please help me if you can.
-
Would also love to see cropping implemented. Cheers.


