Attachment_fu, Paperclip, & S3

For various reasons, I made a git branch and installed Paperclip in
place of attachment_fu. Paperclip works great except that images seem to
have lost some quality; edges have gone a little too jaggy to be able to
drop attachment_fu just yet. After a post on the Paperclip Google Group,
someone suggested the :convert_options could be passed additional
attributes, like ‘quality’, and could make a difference. I’ve attempted
to pass these options across, but, they don’t seem to work; I’m probably
sending them incorrectly because visually obvious options, like
‘rotate’, clearly don’t do anything (or throw any errors, either). Does
anyone know what I’m doing wrong here (?);

Attempt no.1

has_attached_file :avatar, :convert_options => { :rotate => “-rotate
-90” },
:styles => {
:thumb_45 => ‘45x45#’…

Attempt no.2

:convert_options => { :rotate => “-rotate ‘-90’” }

Attempt no.3

:convert_options => { :rotate => “-90” }

Attempt no.4

:convert_options => { :rotate => -90 }

Also, attachment_fu was really easy to set up with S3. I followed a
tutorial from Railsforum (1.), and got it working first time. I’ve read
through the Paperclip docs (2.), but I find the RDocs format to be
pretty inaccessible for a newbie (does ‘+s3_credentials+’ equate to
:s3_credentials, as a symbol?), so I haven’t worked out how to use
Paperclip with S3 or found a tutorial from which I could probably learn
how to do so. Does anyone know, a) how to include the S3 options and
configure paperclip to send images over to S3, and, b) if I’ll get good
results (searching the Paperclip google groups suggests that there could
be some issues with paperclip & S3)?

  1. http://railsforum.com/viewtopic.php?id=17815

  2. http://dev.thoughtbot.com/paperclip/

Any help is tres appreciated (that’s an understatement).

p.s. another dev (not working on the app anymore) set up some European
buckets, and I want to delete them - but the S3Browser keeps telling me
‘Redirected to Nowhere’ whenever I try to do so - any ideas on how to
fix that?.

here’s how to use convert_options from the comments in paperclip.rg:

has_attached_file :avatar, :styles => { :large => “300x300”, :negative
=> “100x100” }
:convert_options => {
:all => “-strip”,
:negative => “-negate”
}

On Sep 2, 8:45 am, Neil C. [email protected]

Keith N. wrote:

here’s how to use convert_options from the comments in paperclip.rg:

has_attached_file :avatar, :styles => { :large => “300x300”, :negative
=> “100x100” }
:convert_options => {
:all => “-strip”,
:negative => “-negate”
}

On Sep 2, 8:45 am, Neil C. [email protected]

Thanks Keith, I’m almost 100% done with implementing Paperclip, I just
need to mock the calls to S3 and make at a background worker for pushing
to S3 instead of tying up mongresl (the later won’t be so easy).

I mentioned the aliasing issue to the guys at thoughtbot - they
suggested trying a different cropping method. I found that ‘scale’
seemed to give a much nicer cropping conversion quality (had to dig in
to the paperclip.rb to get at it, I just couldn’t work out the convert
options), so they pushed it in as the default for Paperclip. It doesn’t
seem to work well when converting PNG to jpg, but that’s something I can
live with. They also implemented buckets on a per environment basis
using the yml config. So I’m really happy with it now, much easier than
attachment fu.

On Wed, Oct 1, 2008 at 12:05 PM, Neil C. <
[email protected]> wrote:

On Sep 2, 8:45 am, Neil C. [email protected]

Thanks Keith, I’m almost 100% done with implementing Paperclip, I just
need to mock the calls to S3 and make at a background worker for pushing
to S3 instead of tying up mongresl (the later won’t be so easy).

Both backgroundjob and spawn are great ways to do this. I use both to
great
affect to do the same thing.


Benjamin C.
http://railskits.com/ - Ready-made Rails code
http://catchthebest.com/ - Team-powered recruiting
http://www.bencurtis.com/ - Personal blog

Benjamin C. wrote:

On Wed, Oct 1, 2008 at 12:05 PM, Neil C. <
[email protected]> wrote:

On Sep 2, 8:45 am, Neil C. [email protected]

Thanks Keith, I’m almost 100% done with implementing Paperclip, I just
need to mock the calls to S3 and make at a background worker for pushing
to S3 instead of tying up mongresl (the later won’t be so easy).

Both backgroundjob and spawn are great ways to do this. I use both to
great
affect to do the same thing.


Benjamin C.
http://railskits.com/ - Ready-made Rails code
http://catchthebest.com/ - Team-powered recruiting
http://www.bencurtis.com/ - Personal blog

Thanks. I was thinking it would mean storing locally and moving to S3 in
the background; someone seems to have taken the same approach in a
thread on the Paperclip google group (although there’s 0 responses so I
don’t know how they got on with it);

http://groups.google.com/group/paperclip-plugin/browse_thread/thread/8af52cc25cd97d02/05221d1a7254601d?lnk=gst&q=background#05221d1a7254601d

There’s an interesting presentation on starling, workling, spawn etc
(among other background workers) which got me thinking about going with
something other than backgroundrb;

…but I just got off the phone with an engine yard account manager for
my app and I’m waiting to see what their devs have to say about.
Apparently they have quite a few apps pushing content to S3, so it’s
something they can help out with; I’m not sure how far they can get in
separating out processes to async processes (I have tons of specs, but
still), but maybe I won’t need to write it all from scratch.

I think this would make a pretty good screencast for someone to make
(and charge for). I’d pay $5 - 10 to see how a pro installs a user
avatar (probably the most common image upload), sets all the right
defaults for paperclip, makes it all secure, sets up decent spec
coverage, asyncs it with S3 (again, which good spec coverage) and makes
it manageable over dev, test, staging, production environments. I’ve
done most of it, but, I would still pay to watch an expert implement it
using best practices.