This commit is contained in:
Espen Antonsen 2009-10-12 00:20:38 +02:00
parent 2643e019e2
commit 1b94fcc84f
3 changed files with 7 additions and 15 deletions

View file

@ -23,17 +23,6 @@ class Photo < ActiveRecord::Base
named_scope :previous, lambda { |p,a| { :conditions => ["id < :id AND album_Id = :album ", { :id => p, :album => a } ], :limit => 1, :order => "id DESC"} }
named_scope :next, lambda { |p,a| { :conditions => ["id > :id AND album_Id = :album ", { :id => p, :album => a } ], :limit => 1, :order => "id ASC"} }
def self.search(q)
if q
conditions = q.split("AND").each {|var|
}
find(:all)
else
find(:all)
end
end
def to_param
"#{id}-#{title.parameterize}"
end
@ -76,9 +65,9 @@ class Photo < ActiveRecord::Base
def exif_info
photo = MiniExiftool.new(self.path_original)
photo.tags.sort.each do |tag|
puts tag.ljust(28) + photo[tag].to_s
end
#photo.tags.sort.each do |tag|
# puts tag.ljust(28) + photo[tag].to_s
#end
end
# Map file extensions to mime types.
@ -92,6 +81,8 @@ class Photo < ActiveRecord::Base
end
def create_thumbnails
# TODO: thumbnails size should be set in settings.yml
return if File.exists?(APP_CONFIG[:thumbs_path] + self.album.path + "/" + self.id.to_s + "_collection" + self.extension)
puts "thumb " + self.path_original
ImageScience.with_image(self.path_original) do |img|

View file

@ -9,6 +9,7 @@
<% content_for :action_links do %>
<% if has_role?("admin") %>
<%= link_to("Delete album", { :action => "destroy", :id => @album },
:confirm => "Are you sure you want to delete this album?",
:method => :delete) %>

View file

@ -1,7 +1,7 @@
# Be sure to restart your server when you modify this file
# Specifies gem version of Rails to use when vendor/rails is not present
RAILS_GEM_VERSION = '2.3.2' unless defined? RAILS_GEM_VERSION
#RAILS_GEM_VERSION = '2.3.4' unless defined? RAILS_GEM_VERSION
# Bootstrap the Rails environment, frameworks, and default configuration
require File.join(File.dirname(__FILE__), 'boot')