diff --git a/app/models/screenshot.rb b/app/models/screenshot.rb index 9e9cb75..7816186 100644 --- a/app/models/screenshot.rb +++ b/app/models/screenshot.rb @@ -148,4 +148,19 @@ class Screenshot < ApplicationRecord self.version.split(/[\-\+]/).first 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