Class: Gallerist::Photo

Inherits:
BaseModel
  • Object
show all
Defined in:
lib/gallerist/models/photo.rb

Overview

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

Instance Method Summary collapse

Methods inherited from BaseModel

iphoto, photos, setup_for, store_setup

Instance Method Details

#image_pathObject



53
54
55
56
57
58
59
60
61
62
# 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

#inspectObject



64
65
66
# 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

#pathObject



68
69
70
# File 'lib/gallerist/models/photo.rb', line 68

def path
  File.dirname master.path
end

#preview_pathObject



86
87
88
89
90
# 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_pathObject



92
93
94
# File 'lib/gallerist/models/photo.rb', line 92

def small_thumbnail_path
  File.join 'Thumbnails', image_proxy_state.small_thumbnail_path
end

#video?Boolean

Returns:

  • (Boolean)


96
97
98
# File 'lib/gallerist/models/photo.rb', line 96

def video?
  type == 8
end