remove active storage analyzers
This commit is contained in:
+3
-2
@@ -122,7 +122,7 @@ module Submitters
|
||||
end
|
||||
end
|
||||
|
||||
def create_attachment!(submitter, file)
|
||||
def create_attachment!(submitter, file, metadata: {})
|
||||
raise ParamsError, 'file param is missing' if file.blank?
|
||||
|
||||
extension = File.extname(file.original_filename).delete_prefix('.').downcase
|
||||
@@ -133,7 +133,8 @@ module Submitters
|
||||
|
||||
blob = ActiveStorage::Blob.create_and_upload!(io: file.tap(&:rewind).open,
|
||||
filename: file.original_filename,
|
||||
content_type: file.content_type)
|
||||
content_type: file.content_type,
|
||||
metadata:)
|
||||
|
||||
ActiveStorage::Attachment.create!(blob:, name: 'attachments', record: submitter)
|
||||
end
|
||||
|
||||
@@ -27,7 +27,9 @@ module Submitters
|
||||
|
||||
text_mask = Vips::Image.black(text_image.width, text_image.height)
|
||||
|
||||
text_mask.bandjoin(text_image).copy(interpretation: :b_w).write_to_buffer('.png')
|
||||
image = text_mask.bandjoin(text_image).copy(interpretation: :b_w)
|
||||
|
||||
[image.write_to_buffer('.png'), image.width, image.height]
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
@@ -260,7 +260,7 @@ module Submitters
|
||||
end
|
||||
|
||||
def find_or_create_blob_from_text(account, text, type)
|
||||
data = Submitters::GenerateFontImage.call(text, font: type)
|
||||
data, width, height = Submitters::GenerateFontImage.call(text, font: type)
|
||||
|
||||
checksum = Digest::MD5.base64digest(data)
|
||||
|
||||
@@ -268,7 +268,9 @@ module Submitters
|
||||
|
||||
blob || ActiveStorage::Blob.create_and_upload!(
|
||||
io: StringIO.new(data),
|
||||
filename: "#{type}.png"
|
||||
filename: "#{type}.png",
|
||||
content_type: 'image/png',
|
||||
metadata: { analyzed: true, identified: true, width:, height: }
|
||||
)
|
||||
end
|
||||
|
||||
|
||||
Reference in New Issue
Block a user