mirror of
https://github.com/danbee/danbarberphoto
synced 2025-03-04 08:49:07 +00:00
Added S3 storage for photos.
This commit is contained in:
parent
774aac75ef
commit
9d1e24de78
3
Gemfile
3
Gemfile
@ -20,7 +20,7 @@ gem 'sqlite3-ruby', :require => 'sqlite3'
|
|||||||
# gem 'bj'
|
# gem 'bj'
|
||||||
# gem 'nokogiri'
|
# gem 'nokogiri'
|
||||||
# gem 'sqlite3-ruby', :require => 'sqlite3'
|
# gem 'sqlite3-ruby', :require => 'sqlite3'
|
||||||
# gem 'aws-s3', :require => 'aws/s3'
|
gem 'aws-s3', :require => 'aws/s3'
|
||||||
|
|
||||||
# Bundle gems for the local environment. Make sure to
|
# Bundle gems for the local environment. Make sure to
|
||||||
# put test-only gems in this group so their generators
|
# put test-only gems in this group so their generators
|
||||||
@ -39,3 +39,4 @@ gem 'rdiscount'
|
|||||||
gem 'paperclip'
|
gem 'paperclip'
|
||||||
gem 'acts_as_markup'
|
gem 'acts_as_markup'
|
||||||
gem 'jquery-rails', '>= 0.2.6'
|
gem 'jquery-rails', '>= 0.2.6'
|
||||||
|
gem 'yaml_db'
|
||||||
|
|||||||
@ -58,6 +58,10 @@ GEM
|
|||||||
wikitext (~> 2.0)
|
wikitext (~> 2.0)
|
||||||
arel (1.0.1)
|
arel (1.0.1)
|
||||||
activesupport (~> 3.0.0)
|
activesupport (~> 3.0.0)
|
||||||
|
aws-s3 (0.6.2)
|
||||||
|
builder
|
||||||
|
mime-types
|
||||||
|
xml-simple
|
||||||
builder (2.1.2)
|
builder (2.1.2)
|
||||||
erubis (2.6.6)
|
erubis (2.6.6)
|
||||||
abstract (>= 1.0.0)
|
abstract (>= 1.0.0)
|
||||||
@ -109,12 +113,15 @@ GEM
|
|||||||
polyglot (>= 0.3.1)
|
polyglot (>= 0.3.1)
|
||||||
tzinfo (0.3.23)
|
tzinfo (0.3.23)
|
||||||
wikitext (2.1.1)
|
wikitext (2.1.1)
|
||||||
|
xml-simple (1.1.1)
|
||||||
|
yaml_db (0.2.2)
|
||||||
|
|
||||||
PLATFORMS
|
PLATFORMS
|
||||||
ruby
|
ruby
|
||||||
|
|
||||||
DEPENDENCIES
|
DEPENDENCIES
|
||||||
acts_as_markup
|
acts_as_markup
|
||||||
|
aws-s3
|
||||||
exception_notification!
|
exception_notification!
|
||||||
jquery-rails (>= 0.2.6)
|
jquery-rails (>= 0.2.6)
|
||||||
meta_where
|
meta_where
|
||||||
@ -126,3 +133,4 @@ DEPENDENCIES
|
|||||||
sqlite3-ruby
|
sqlite3-ruby
|
||||||
typus!
|
typus!
|
||||||
will_paginate!
|
will_paginate!
|
||||||
|
yaml_db
|
||||||
|
|||||||
@ -9,7 +9,13 @@ class Photo < ActiveRecord::Base
|
|||||||
:size8 => "224x224#",
|
:size8 => "224x224#",
|
||||||
:size5 => "140x140#",
|
:size5 => "140x140#",
|
||||||
:size3 => "84x84#",
|
:size3 => "84x84#",
|
||||||
:size2 => "56x56#" }
|
:size2 => "56x56#" },
|
||||||
|
:storage => :s3,
|
||||||
|
:s3_credentials => "#{RAILS_ROOT}/config/s3.yml",
|
||||||
|
:s3_protocol => "https",
|
||||||
|
:path => ":attachment/:id/:style.:extension",
|
||||||
|
:bucket => 'danbarberphoto',
|
||||||
|
:url => ":s3_eu_url"
|
||||||
|
|
||||||
after_create :get_exif
|
after_create :get_exif
|
||||||
|
|
||||||
|
|||||||
9
config/initializers/paperclip.rb
Normal file
9
config/initializers/paperclip.rb
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
Paperclip.interpolates(:s3_eu_url) do |att, style|
|
||||||
|
"#{att.s3_protocol}://s3-eu-west-1.amazonaws.com/#{att.bucket_name}/#{att.path(style)}"
|
||||||
|
end
|
||||||
|
|
||||||
|
module AWS
|
||||||
|
module S3
|
||||||
|
DEFAULT_HOST = "s3-eu-west-1.amazonaws.com"
|
||||||
|
end
|
||||||
|
end
|
||||||
1034
db/data.yml
Normal file
1034
db/data.yml
Normal file
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue
Block a user