path no longer in use for photos. can get absolute path from file
This commit is contained in:
parent
af3f3bada1
commit
2487ca887d
|
@ -70,7 +70,7 @@ class Photo < ActiveRecord::Base
|
||||||
end
|
end
|
||||||
|
|
||||||
def exif_read
|
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.longitude = photo.GPSLongitude if self.longitude.nil?
|
||||||
self.latitude = photo.GPSLatitude if self.latitude.nil?
|
self.latitude = photo.GPSLatitude if self.latitude.nil?
|
||||||
self.title = photo.DocumentName if self.title.nil?
|
self.title = photo.DocumentName if self.title.nil?
|
||||||
|
@ -80,7 +80,7 @@ class Photo < ActiveRecord::Base
|
||||||
|
|
||||||
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
|
# 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.GPSLongitude = self.longitude
|
||||||
photo.GPSLatitude = self.latitude
|
photo.GPSLatitude = self.latitude
|
||||||
photo.DocumentName = self.title
|
photo.DocumentName = self.title
|
||||||
|
|
|
@ -11,4 +11,4 @@
|
||||||
<%= form.label :description %><br />
|
<%= form.label :description %><br />
|
||||||
<%= form.text_area :description %><br />
|
<%= form.text_area :description %><br />
|
||||||
<br/>
|
<br/>
|
||||||
<p>On disk: ~/<%= @photo.path %></p>
|
<p>On disk: ~/<%= @photo.file.file.file %></p>
|
8
db/migrate/20110411074351_remove_path_from_photos.rb
Normal file
8
db/migrate/20110411074351_remove_path_from_photos.rb
Normal file
|
@ -0,0 +1,8 @@
|
||||||
|
class RemovePathFromPhotos < ActiveRecord::Migration
|
||||||
|
def self.up
|
||||||
|
remove_column :photos, :path
|
||||||
|
end
|
||||||
|
|
||||||
|
def self.down
|
||||||
|
end
|
||||||
|
end
|
|
@ -10,7 +10,7 @@
|
||||||
#
|
#
|
||||||
# It's strongly recommended to check this file into your version control system.
|
# 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|
|
create_table "albums", :force => true do |t|
|
||||||
t.string "title", :null => false
|
t.string "title", :null => false
|
||||||
|
@ -70,7 +70,6 @@ ActiveRecord::Schema.define(:version => 20100412220801) do
|
||||||
t.integer "album_id"
|
t.integer "album_id"
|
||||||
t.datetime "created_at"
|
t.datetime "created_at"
|
||||||
t.datetime "updated_at"
|
t.datetime "updated_at"
|
||||||
t.text "path"
|
|
||||||
t.float "longitude"
|
t.float "longitude"
|
||||||
t.float "latitude"
|
t.float "latitude"
|
||||||
t.string "file"
|
t.string "file"
|
||||||
|
|
Loading…
Reference in a new issue