TODO: Write a gem description
Add this line to your application's Gemfile:
gem 'media_magick'
And then execute:
$ bundle
Or install it yourself as:
$ gem install media_magick
class Album
include Mongoid::Document
include MediaMagick
attach_many :photos
end
album = Album.new
album.photos.new(photo: params[:file])
album.save!
album.photos.first.url
album.photos.first.filename
album.photos.first.content_type
album.photos.first.width # only images
album.photos.first.height # only imagesclass Album
include Mongoid::Document
include MediaMagick
attach_many :photos do
field :tags, type: Array
end
end
album = Album.new
album.photos.new(photo: params[:file], tags: ['ruby', 'guru'])
album.save!
album.photos.first.tagsclass Album
include Mongoid::Document
include MediaMagick
attach_many :soundtrack, custom_uploader: true do
# Carrierwave
mount_uploader :music, AmazonS3Uploader
end
attach_many :photos, custom_uploader: true do
# Dragonfly
field :image_uid
image_accessor :image
end
end<%= attachment_container @album, :photos do %>
<a class="pickAttachments btn" href="javascript://">select files</a>
<a class="uploadAttachments btn" href="javascript://">upload files</a>
<ul class="loadedAttachments">
<%= render :partial => 'photos', :collection => @album.photos, :as => 'photo' %>
</ul>
<% end %>$(document).ready(function () {
$(".attachmentUploader").pluploadIt();
});- Fork it
- Create your feature branch (
git checkout -b my-new-feature) - Commit your changes (
git commit -am 'Added some feature') - Push to the branch (
git push origin my-new-feature) - Create new Pull Request