update readme. using sqlite3 as default for dev. minimagick as default processor. reanabled exif read/write

This commit is contained in:
Espen Antonsen 2011-04-11 12:38:53 +08:00
parent 7f8074a5bf
commit 58572966aa
9 changed files with 38 additions and 23 deletions

1
.gitignore vendored
View file

@ -1,4 +1,5 @@
.bundle .bundle
.rvmrc
db/*.sqlite3 db/*.sqlite3
log/*.log log/*.log
tmp tmp

View file

@ -9,16 +9,18 @@ gem "carrierwave", :git => 'git://github.com/jnicklas/carrierwave.git'
#gem "mysql2" #gem "mysql2"
# PostgreSQL: # PostgreSQL:
gem 'pg' gem 'pg'
# SQLite
gem 'sqlite3-ruby'
# S3 support # S3 support
gem 'fog' gem 'fog'
# ImageMagick: # ImageMagick:
gem "rmagick", :require => 'RMagick' #gem "rmagick", :require => 'RMagick'
# FreeImage: # FreeImage:
#gem "RubyInline" #gem "RubyInline"
#gem "image_science", :git => 'git://github.com/perezd/image_science.git' #gem "image_science", :git => 'git://github.com/perezd/image_science.git'
# MiniMagick # MiniMagick
#gem "mini_magick" gem "mini_magick"

View file

@ -60,6 +60,8 @@ GEM
mime-types (~> 1.16) mime-types (~> 1.16)
treetop (~> 1.4.8) treetop (~> 1.4.8)
mime-types (1.16) mime-types (1.16)
mini_magick (3.2)
subexec (~> 0.0.4)
net-ssh (2.0.23) net-ssh (2.0.23)
nokogiri (1.4.4) nokogiri (1.4.4)
pg (0.10.0) pg (0.10.0)
@ -83,8 +85,11 @@ GEM
rake (>= 0.8.7) rake (>= 0.8.7)
thor (~> 0.14.4) thor (~> 0.14.4)
rake (0.8.7) rake (0.8.7)
rmagick (2.13.1)
ruby-hmac (0.4.0) ruby-hmac (0.4.0)
sqlite3 (1.3.3)
sqlite3-ruby (1.3.3)
sqlite3 (>= 1.3.3)
subexec (0.0.4)
thor (0.14.6) thor (0.14.6)
treetop (1.4.9) treetop (1.4.9)
polyglot (>= 0.3.1) polyglot (>= 0.3.1)
@ -98,6 +103,7 @@ DEPENDENCIES
carrierwave! carrierwave!
fog fog
mime-types mime-types
mini_magick
pg pg
rails (= 3.0.3) rails (= 3.0.3)
rmagick sqlite3-ruby

20
README
View file

@ -31,7 +31,7 @@ Free for personal use. Contact me for commercial license.
Rails 3.0 Rails 3.0
Software Software
- RMagicK (required for Carrierwave resizing). Can also use ImageScience - ImageMagicK (required for Carrierwave resizing). Can also use ImageScience
Optional: Optional:
- ExifTool (required for Mini_EfixTool) - ExifTool (required for Mini_EfixTool)
@ -47,15 +47,15 @@ Optional:
1. Clone the project from GitHub or Gitorious: 1. Clone the project from GitHub or Gitorious:
GitHub: git clone git://github.com/espen/balder.git GitHub: git clone git://github.com/espen/balder.git
Gitorious: git clone git://gitorious.org/gallery-without-a-name/gallery-without-a-name.git 2. Install required software listed above
2. install required software listed above 3. 'bundle install' to install required gems.
3. Copy settings file: 4. Adjust the settings in balder.rb
cp gallery/config/database.example.yml gallery/config/database.yml 5. Copy database file (not needed when hosting on Heroku):
cp gallery/config/settings.example.yml gallery/config/settings.yml cp config/database.example.yml config/database.yml
4. Create databsae user and edit settings files. 6. Create database user and edit database file. (unless on Heroku or using SQLite3)
5. rake db:create 7. rake db:create
6. rake db:migrate 8. rake db:migrate
7. Start up the project with your preferred web-server 9. Start up the project with your preferred web-server
=== Optional: add photos directly to disk === Optional: add photos directly to disk

View file

@ -45,7 +45,7 @@ class ApplicationController < ActionController::Base
end end
def check_public_access def check_public_access
require_user if ENV['PUBLIC'] == 'false' require_user if ENV['PRIVATE'] == 'true'
end end
def current_user_session def current_user_session

View file

@ -10,8 +10,8 @@ class Photo < ActiveRecord::Base
validates :title, :presence => true validates :title, :presence => true
before_validation :set_title before_validation :set_title
#before_create :exif_read before_create :exif_read
#before_update :exif_write # should only write if tags are changed as images can be large and thus ExifTool will take a while to write to the file before_update :exif_write
attr_accessor :tag_list attr_accessor :tag_list
#attr_protected :path #attr_protected :path
@ -79,6 +79,7 @@ class Photo < ActiveRecord::Base
end end
def exif_write def exif_write
# should only write if tags are changed as images can be large and thus ExifTool will take a while to write to the file
photo = MiniExiftool.new(self.path.file) photo = MiniExiftool.new(self.path.file)
photo.GPSLongitude = self.longitude photo.GPSLongitude = self.longitude
photo.GPSLatitude = self.latitude photo.GPSLatitude = self.latitude

View file

@ -3,9 +3,9 @@
class FileUploader < CarrierWave::Uploader::Base class FileUploader < CarrierWave::Uploader::Base
# Include RMagick or ImageScience support # Include RMagick or ImageScience support
include CarrierWave::RMagick # include CarrierWave::RMagick
# include CarrierWave::ImageScience # include CarrierWave::ImageScience
# include CarrierWave::MiniMagick include CarrierWave::MiniMagick
# Choose what kind of storage to use for this uploader # Choose what kind of storage to use for this uploader
if ENV['S3_KEY'] if ENV['S3_KEY']
storage :s3 storage :s3

View file

@ -4,6 +4,9 @@
<script type="text/javascript"> <script type="text/javascript">
$(document).ready(function() { $(document).ready(function() {
if(swfobject.hasFlashPlayerVersion("9.0.0")) {
$('#noFlash').hide()
}
$('#photo_file').uploadify({ $('#photo_file').uploadify({
uploader:'<%= javascript_path "uploadify-2.1/uploadify.swf" -%>', uploader:'<%= javascript_path "uploadify-2.1/uploadify.swf" -%>',
script:'<%= photos_path %>', script:'<%= photos_path %>',
@ -30,6 +33,8 @@ $(document).ready(function() {
}) })
</script> </script>
<% end %> <% end %>
<div id="noFlash">I'm really sorry, you need Flash to upload files.</div>
<form> <form>
<input type="file" id="photo_file"> <input type="file" id="photo_file">
<br> <br>

View file

@ -1,8 +1,8 @@
development: development:
adapter: postgresql adapter: sqlite3
database: balder_development database: db/development.sqlite3
username: balder pool: 5
password: changeme timeout: 5000
production: production:
adapter: mysql adapter: mysql
encoding: utf8 encoding: utf8