Skip to content

Commit

Permalink
added README
Browse files Browse the repository at this point in the history
  • Loading branch information
yortz committed Mar 25, 2011
1 parent c4ecc32 commit 848d32f
Show file tree
Hide file tree
Showing 3 changed files with 73 additions and 259 deletions.
256 changes: 0 additions & 256 deletions README

This file was deleted.

70 changes: 70 additions & 0 deletions README.textile
@@ -0,0 +1,70 @@
h1. Description:

Sample app using Rails 3, "carrierwave":https://github.com/jnicklas/carrierwave and "jquery-file-upload":https://github.com/blueimp/jQuery-File-Upload to upload and store files on Amazon S3.

h1. Install:

* Clone or fork the github repo
* cd into app directory

<pre>
<code>
$: bundle install #install required gems
$: rake db:create:all #create dbs
$: rake db:migrate #migrate db
$: rails s #start app
</code>
</pre>

h1. S3:

Since this app stores files to amazon S3 you will need an "Amazon S3":http://aws.amazon.com/s3/ account, otherwise you can choose to store images on your local filesystem by editing the uploader:

<pre>
<code>
#app/uploaders/image_uploader.rb
# Choose what kind of storage to use for this uploader:
storage :file #stores files locally
# storage :fog #stores files on S3
</code>
</pre>

Amazon S3 support is made possibile by "Fog":https://github.com/geemus/fog ; you will need to tell carrierwave to use Amazons S3 by creating an initializer and providing your Amazon S3 authentication details:

<pre>
<code>
#config/initializers/carrierwave.rb

CarrierWave.configure do |config|
config.fog_credentials = {
:provider => 'AWS', # required
:aws_access_key_id => 'amazon s3 access key', # required
:aws_secret_access_key => 'amazon s3 secret access key', # required
:region => 'us-west-1' # optional, defaults to 'us-east-1'
}
config.fog_directory = 'yourbucketname' # required
config.fog_host = 'http://yourbucketname.s3.amazonaws.com/' # optional, defaults to nil
config.fog_public = false # optional, defaults to true
config.fog_attributes = {'Cache-Control'=>'max-age=315576000'} # optional, defaults to {}
end
</code>
</pre>

h1. Image Processing:

App default for processing images is MiniMagick; if you want to use another library, just edit the Gemfile and modify the uploader accordingly to your choice:

<pre>
<code>
#app/uploaders/image_uploader.rb
# Include RMagick or ImageScience support:
# include CarrierWave::RMagick
include CarrierWave::ImageScience
# include CarrierWave::MiniMagick
</code>
</pre>

h1. TODO:

* testing
* better validation handling
6 changes: 3 additions & 3 deletions config/database.yml
Expand Up @@ -9,7 +9,7 @@ development:
adapter: mysql2
encoding: utf8
reconnect: false
database: jquery_carrierwave_development
database: c_j_f_u_development
pool: 5
username: root
password:
Expand All @@ -22,7 +22,7 @@ test:
adapter: mysql2
encoding: utf8
reconnect: false
database: jquery_carrierwave_test
database: c_j_f_u_test
pool: 5
username: root
password:
Expand All @@ -32,7 +32,7 @@ production:
adapter: mysql2
encoding: utf8
reconnect: false
database: jquery_carrierwave_production
database: c_j_f_u_production
pool: 5
username: root
password:
Expand Down

0 comments on commit 848d32f

Please sign in to comment.