Forum: Ruby on Rails Attachment_fu, db_file and Windows

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
John C. (Guest)
on 2008-10-15 00:45
I'm having trouble serving images which I have saved as db_files with
attachment_fu.  I use this code to serve the images:

Controller --
class PhotoController < ApplicationController
  def image
    @photo=Photo.find(params[:id])
    send_data(DbFile.find(@photo.db_file_id).data,
                          :type => @photo.content_type,
                          :filename => @photo.filename,
                          :disposition => 'inline')
  end
end

View --
<%=image_tag(url_for(:controller=>'photo', :action=>'image',
:id=>@photo))%>

On the web page, I just get a box with a red X in it where the image
should be.  This occurs only on my development machine (windows XP) but
not on my production machine (linux).  On my production machine all
works perfectly.

To debug, I switched :disposition=>'inline' to
:disposition=>'attachment', downloaded the file, and opened with GIMP.
GIMP reports these errors:
"Premature end of JPEG file" and
"Invalid JPEG file structure -- missing SOS marker".

Does anyone have any ideas?

I am using ImageScience as my processor.

(BTW, I have already implemented the attachment_fu_patch which fixes
various windows/attachment_fu problems described here --
http://epirsch.blogspot.com/2008/01/fixing-attachm....)
This topic is locked and can not be replied to.