Added helper methods for screenshots
This commit is contained in:
parent
cfe6790179
commit
771ca41240
1 changed files with 15 additions and 0 deletions
|
|
@ -148,4 +148,19 @@ class Screenshot < ApplicationRecord
|
||||||
self.version.split(/[\-\+]/).first
|
self.version.split(/[\-\+]/).first
|
||||||
end
|
end
|
||||||
|
|
||||||
|
# Returns the path to this screenshot's image on disk
|
||||||
|
def disk_path
|
||||||
|
ActiveStorage::Blob.service.send(:path_for, self.image.key)
|
||||||
|
end
|
||||||
|
|
||||||
|
def checksum
|
||||||
|
# local files stored on disk:
|
||||||
|
# url = "#{Rails.root}/public/#{attachment.path}"
|
||||||
|
Digest::MD5.hexdigest(disk_path)
|
||||||
|
|
||||||
|
# remote files stored on another person's computer:
|
||||||
|
#url = attachment.url
|
||||||
|
#Digest::MD5.base64digest(Net::HTTP.get(URI(url)))
|
||||||
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue