Class: ImagePath::Custom
- Defined in:
- lib/httpimagestore/image_path.rb
Instance Method Summary collapse
-
#initialize(id, path) ⇒ Custom
constructor
A new instance of Custom.
- #original_image(mime_type) ⇒ Object
- #thumbnail_image(mime_type, thumbnail_class) ⇒ Object
Constructor Details
#initialize(id, path) ⇒ Custom
Returns a new instance of Custom.
33 34 35 36 |
# File 'lib/httpimagestore/image_path.rb', line 33 def initialize(id, path) super(id) @path = Pathname.new(path) end |
Instance Method Details
#original_image(mime_type) ⇒ Object
38 39 40 41 42 43 44 45 46 47 |
# File 'lib/httpimagestore/image_path.rb', line 38 def original_image(mime_type) extension = begin mime_extension(mime_type) rescue CouldNotDetermineFileExtensionError raise if @path.extname.empty? @path.extname end (@path.dirname + @id + "#{@path.basename(@path.extname)}#{extension}").to_s end |
#thumbnail_image(mime_type, thumbnail_class) ⇒ Object
49 50 51 |
# File 'lib/httpimagestore/image_path.rb', line 49 def thumbnail_image(mime_type, thumbnail_class) (@path.dirname + @id + "#{@path.basename(@path.extname)}-#{thumbnail_class}#{mime_extension(mime_type)}").to_s end |