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 --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
On 04 Sep 2007, at 23:40, Scott wrote:> 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.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 --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
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 On Sep 4, 4:17 pm, Peter De Berdt <peter.de.be...-LPO8gxj9N8aZIoH1IeqzKA@public.gmane.org> wrote:> On 04 Sep 2007, at 23:40, Scott wrote: > > > > > 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. > > 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 athttp://blog.airbladesoftware.com/2007/8/8/ > uploading-files-with-swfupload). > > Best regards > > Peter De Berdt--~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
KathysKode-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org
2007-Sep-07 14:05 UTC
Re: attachment_fu and bmp files not working
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 KathysKode-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org On Sep 6, 7:52 pm, Scott <tamosu...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> 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 > > On Sep 4, 4:17 pm, Peter De Berdt <peter.de.be...-LPO8gxj9N8aZIoH1IeqzKA@public.gmane.org> wrote: > > > > > On 04 Sep 2007, at 23:40, Scott wrote: > > > > 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. > > > 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 athttp://blog.airbladesoftware.com/2007/8/8/ > > uploading-files-with-swfupload). > > > Best regards > > > Peter De Berdt- Hide quoted text - > > - Show quoted text ---~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---