1
0
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:
Dan Barber 2011-10-28 12:33:56 +01:00
parent 774aac75ef
commit 9d1e24de78
5 changed files with 1060 additions and 2 deletions

View File

@ -20,7 +20,7 @@ gem 'sqlite3-ruby', :require => 'sqlite3'
# gem 'bj'
# gem 'nokogiri'
# 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
# put test-only gems in this group so their generators
@ -39,3 +39,4 @@ gem 'rdiscount'
gem 'paperclip'
gem 'acts_as_markup'
gem 'jquery-rails', '>= 0.2.6'
gem 'yaml_db'

View File

@ -58,6 +58,10 @@ GEM
wikitext (~> 2.0)
arel (1.0.1)
activesupport (~> 3.0.0)
aws-s3 (0.6.2)
builder
mime-types
xml-simple
builder (2.1.2)
erubis (2.6.6)
abstract (>= 1.0.0)
@ -109,12 +113,15 @@ GEM
polyglot (>= 0.3.1)
tzinfo (0.3.23)
wikitext (2.1.1)
xml-simple (1.1.1)
yaml_db (0.2.2)
PLATFORMS
ruby
DEPENDENCIES
acts_as_markup
aws-s3
exception_notification!
jquery-rails (>= 0.2.6)
meta_where
@ -126,3 +133,4 @@ DEPENDENCIES
sqlite3-ruby
typus!
will_paginate!
yaml_db

View File

@ -9,7 +9,13 @@ class Photo < ActiveRecord::Base
:size8 => "224x224#",
:size5 => "140x140#",
: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

View 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

File diff suppressed because it is too large Load Diff