I’ve been working with attachment_fu and have found some curious
behavior when using firefox as a browser. I’ve been following the
straightforward example that is referenced in attachment_fu’s
readme.
Simply put, I have a view/new… that accepts an image file and uses
attachment_fu in the model to store the file and thumbnail on the
filesystem. The view/index… puts up the thumbnails as “link_to”
pointing at their respective full size images. I’ve been feeding in
jpeg image files and using rmagick as the image processor.
All works as advertised as long as the filename’s type is lowercase.
i.e.:
file.jpg === good
file.JPG === bad
What happens in the good case is selecting the thumbnail link causes
the fullsize image to display in the window that previously showed the
view/index…
What happens in the bad case is selecting the link causes a dialog box
to pop up asking me what I want to do with this “JPEG Picture”
content. If I select to display it in firefox it is first downloaded
and then displayed in a new window.
NOTE: The file_thumb.JPG which corresponds to the (bad) file.JPG
displays normally on the view/index… page.
NOTE: Mugshot.find(:all) shows all records (good and bad types) to
have “image/jpeg” as content_type.
NOTE: All images (good and bad) open normally when accessed directly
from the filesystem.
i.e.:
file://…/public/mugshots/0000/0001/file.JPG works
http://localhost…/0001/file.JPG doesn’t
Since I cannot reproduce this problem with either Opera, Safari, or IE
(go figure:-), I’ve opened an issue with the firefox folks.
My question here is what is the RoR server handing firefox that is
causing it to trip up?
Environment:
Ruby version 1.8.7 (powerpc-darwin9.6.0)
RubyGems version 1.3.1
Rack version 1.0 bundled
Rails version 2.3.2
Active Record version 2.3.2
Action Pack version 2.3.2
Active Resource version 2.3.2
Action Mailer version 2.3.2
Active Support version 2.3.2
Application root /Users/rick/example/mugshots
Environment development
Database adapter sqlite3
Database schema version 20090424050842
Run either Thin or Webrick - makes no difference
Grab current attachment_fu from github
I’m ready to sit naked in the dirt and wait for inspiration - not a
pretty sight I’m sure.