Attachment_fu and bmp files not working

I have been using attachment_fu for a while now with jpg, gif, png
without any trouble. I recently tried to upload a bmp and got:

“Content type is not included in the list”

So, I added the following to the @@content_types in attachment_fu:

‘image/bmp’, ‘image/x-bmp’

Same problem.

Closer inspection of the content_type of the file was coming through
as ‘application/octet-stream’.

I am using RMagick as the image processor.

Has anyone else run into this problem with bmp and attachment_fu? Is
there another content_type that will resolve this? I tried adding
‘application/octet-stream’ to my content types but this didn’t work
nor feel right.

Thanks,

Scott

On 04 Sep 2007, at 23:40, Scott wrote:

Closer inspection of the content_type of the file was coming through
as ‘application/octet-stream’.

I am using RMagick as the image processor.

Has anyone else run into this problem with bmp and attachment_fu? Is
there another content_type that will resolve this? I tried adding
‘application/octet-stream’ to my content types but this didn’t work
nor feel right.

application/octet-stream is just a generic file stream, i.e. without
a known mime type. You could patch attachment_fu (the code of the
plugin is so nice and neat you’ll have no problem finding the right
place) to use the .bmp extension to determine the file type (or use
the similar directions at http://blog.airbladesoftware.com/2007/8/8/
uploading-files-with-swfupload).

Best regards

Peter De Berdt

I hope I’m not fragmenting your thread here but do any of you guys
know how to get attachment_fu to send a ‘healthy’ image file up to S3?
I’ve followed this in detail my Windows XP development box, only a
ZERO k file is being uploaded to S3 for any type of file from .png
to .gif to .jpg.
Obviously, I will run my application eventually on a Linux server but
it sure would be nice to see my photos in development.
Thank you,
Kathleen
[email protected]

Thanks for pointing me the right direction Peter.

Seems that all I needed to do was augment the uplaoded_data= method
to:

    if file_data.content_type == 'application/octet-stream' &&

File.extname(uploaded_data.original_filename) == “.bmp” then
self.content_type = ‘image/bmp’
else
self.content_type = file_data.content_type
end

That seems to have done the trick.

Scott