CarrierWave::Magic
This allows to set file type with ruby-filemagic instead of an extension
It also sets correct file extension with mime-types gem.
I recommend using 'mime_types' gem from git:
gem 'mime-types', github: 'halostatue/mime-types'
Idea and some of the code from this pull request: https://github.com/jnicklas/carrierwave/pull/949
Installation
Add this line to your application's Gemfile:
gem 'carrierwave-magic'
And then execute:
$ bundle
Or install it yourself as:
$ gem install carrierwave-magic
Usage
class ImageUploader < CarrierWave::Uploader::Base
include CarrierWave::Magic
process :set_magic_content_type
end
Contributing
- Fork it
- Create your feature branch (
git checkout -b my-new-feature
) - Commit your changes (
git commit -am 'Add some feature'
) - Push to the branch (
git push origin my-new-feature
) - Create new Pull Request