class Gallerist::Photo

This code is free software; you can redistribute it and/or modify it under the terms of the new BSD License.

Copyright © 2015, Sebastian Staudt

Public Instance Methods

image_path() click to toggle source
# File lib/gallerist/models/photo.rb, line 53
def image_path
  if model_resource && !video?
    uuid = model_resource.uuid
    first, second = uuid[0].ord.to_s, uuid[1].ord.to_s

    File.join 'resources', 'modelresources', first, second, uuid, model_resource.file_name
  else
    File.join 'Masters', master.path
  end
end
inspect() click to toggle source
# File lib/gallerist/models/photo.rb, line 64
def inspect
  "#<%s id=%d uuid=%s file_name='%s'>" % [ self.class, id, uuid, file_name ]
end
path() click to toggle source
# File lib/gallerist/models/photo.rb, line 68
def path
  File.dirname master.path
end
person_photos() click to toggle source
# File lib/gallerist/models/photo.rb, line 21
def person_photos
  Gallerist::PersonPhoto.where master_uuid: master.uuid
end
persons() click to toggle source
# File lib/gallerist/models/photo.rb, line 75
def persons
  Gallerist::Person.where modelId: person_photos.map(&:person_id)
end
preview_path() click to toggle source
# File lib/gallerist/models/photo.rb, line 86
def preview_path
  dir_name = File.dirname master.path
  image_name = File.basename(master.path, '.*') + '.jpg'
  File.join 'Previews', dir_name, image_name
end
small_thumbnail_path() click to toggle source
# File lib/gallerist/models/photo.rb, line 92
def small_thumbnail_path
  File.join 'Thumbnails', image_proxy_state.small_thumbnail_path
end
video?() click to toggle source
# File lib/gallerist/models/photo.rb, line 96
def video?
  type == 8
end