# Attachment\_fu, db\_file and Windows

**URL:** <https://www.ruby-forum.com/t/attachment-fu-db-file-and-windows/150919>\
**Category:** Rails\
**Created:** [October 14, 2008, 10:45pm UTC](https://www.ruby-forum.com/t/attachment-fu-db-file-and-windows/150919 "2008-10-14T22:45:59Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![amin1426](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/4da419/32.png) [@amin1426](https://www.ruby-forum.com/u/amin1426)\
**Post date:** [October 14, 2008, 10:45pm UTC](https://www.ruby-forum.com/t/attachment-fu-db-file-and-windows/150919/1 "2008-10-14T22:45:59Z")

</div>

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-attachmentfu-on-windows-like.html.](http://epirsch.blogspot.com/2008/01/fixing-attachmentfu-on-windows-like.html.))
