README.rdoc in attached-0.0.9 vs README.rdoc in attached-0.1.0
- old
+ new
@@ -1,8 +1,8 @@
= Attached
-Attached is a Ruby on Rails file attachment tool that lets users upload to the cloud, then process in the cloud. The tool supports Amazon S3 by default. It surpasses Paperclip by providing built-in support for direct uploads to the cloud and by allowing integration with cloud based processing tools. However, in almost every other way Paperclip is better. The source code inspired (and copied) from Paperclip. If you aren't working in the cloud exclusively then this isn't for you!
+Attached is a Ruby on Rails file attachment tool that lets users upload to the cloud, then process in the cloud. The tool supports Amazon S3 by default. It surpasses Paperclip by providing built-in support for direct uploads to the cloud and by allowing integration with cloud based processing tools. However, in almost every other way Paperclip is better. The source code is inspired (and copied) from Paperclip. If you aren't working in the cloud exclusively then this isn't for you!
== Installation
gem install attached
@@ -11,13 +11,13 @@
Migration:
class CreateVideo < ActiveRecord::Migration
def self.up
create_table :videos do |t|
- t.string :video_identifier
- t.string :video_extension
- t.integer :video_size
+ t.string :encoding_identifier
+ t.string :encoding_extension
+ t.integer :encoding_size
t.timestamps
end
end
@@ -26,29 +26,54 @@
end
end
Model:
- has_attached :video, :styles => {
- :mp4_720p => { :extension => 'mp4' },
- :mp4_480p => { :extension => 'mp4' },
- :ogv_720p => { :extension => 'ogv' },
- :ogv_480p => { :extension => 'ogv' },
+ has_attached :encoding, :styles => {
+ :mp4_720p => { :extension => '.mp4' },
+ :mp4_480p => { :extension => '.mp4' },
+ :ogg_720p => { :extension => '.ogv' },
+ :ogg_480p => { :extension => '.ogv' },
}
+ after_save do
+ remote.encode(self.encoding.url)
+ end
+
Form:
<%= form_for @video, :html => { :multipart => true } do |form| %>
- <%= form.file_field :video %>
- <p class="errors"><%= @video.errors[:video] %></p>
+ <%= form.file_field :encoding %>
+ <p class="errors"><%= @video.errors[:encoding] %></p>
<% end %>
View:
<video>
- <source src="<%= @video.video.url(:mp4_480p) %>" />
- <source src="<%= @video.video.url(:ogv_480p) %>" />
+ <source src="<%= @video.encoding.url(:mp4_480p) %>" />
+ <source src="<%= @video.encoding.url(:ogg_480p) %>" />
</video>
+
+== Advanced
+
+=== Storage
+
+ has_attached :avatar, :provider => :amazon, :credentials => {
+ :secret_access_key => "*****",
+ :access_key_id => "*****",
+ }
+
+ has_attached :avatar, :provider => :google, :credentials => {
+ :secret_access_key => "*****",
+ :access_key_id => "*****",
+ }
+
+=== Processor
+
+ has_attached :avatar, :processor => :resize, :styles => {
+ :small => { :size => "200x200#" }
+ :large => { :size => "200x200#" }
+ }
== Copyright
Copyright (c) 2010 Kevin Sylvestre. See LICENSE for details.