debshots/app/models/screenshot.rb

10 lines
344 B
Ruby

class Screenshot < ActiveRecord::Base
belongs_to :package
# Return the URL to this screenshot.
# size: 'small' (thumbnail) or 'large' (full-size)
# (If possible serve the screenshots statically from the web server.)
def image_url(size)
"/screenshots/#{self.package.name[0]}/#{self.package.name}/#{self.id}_#{size}.png"
end
end