path no longer in use for photos. can get absolute path from file

master
Espen Antonsen 2011-04-11 15:53:51 +08:00
parent af3f3bada1
commit 2487ca887d
4 changed files with 12 additions and 5 deletions

View File

@ -70,7 +70,7 @@ class Photo < ActiveRecord::Base
end
def exif_read
photo = MiniExiftool.new(self.file.path)
photo = MiniExiftool.new(self.file.file.file)
self.longitude = photo.GPSLongitude if self.longitude.nil?
self.latitude = photo.GPSLatitude if self.latitude.nil?
self.title = photo.DocumentName if self.title.nil?
@ -80,7 +80,7 @@ class Photo < ActiveRecord::Base
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.file.file.file)
photo.GPSLongitude = self.longitude
photo.GPSLatitude = self.latitude
photo.DocumentName = self.title

View File

@ -11,4 +11,4 @@
<%= form.label :description %><br />
<%= form.text_area :description %><br />
<br/>
<p>On disk: ~/<%= @photo.path %></p>
<p>On disk: ~/<%= @photo.file.file.file %></p>

View File

@ -0,0 +1,8 @@
class RemovePathFromPhotos < ActiveRecord::Migration
def self.up
remove_column :photos, :path
end
def self.down
end
end

View File

@ -10,7 +10,7 @@
#
# It's strongly recommended to check this file into your version control system.
ActiveRecord::Schema.define(:version => 20100412220801) do
ActiveRecord::Schema.define(:version => 20110411074351) do
create_table "albums", :force => true do |t|
t.string "title", :null => false
@ -70,7 +70,6 @@ ActiveRecord::Schema.define(:version => 20100412220801) do
t.integer "album_id"
t.datetime "created_at"
t.datetime "updated_at"
t.text "path"
t.float "longitude"
t.float "latitude"
t.string "file"