Files
baclight/app/services/image_processor.rb
T
Jason Jordan 4fac3b1036
CI / scan_ruby (push) Failing after 10m41s
CI / lint (push) Failing after 7m31s
CI / test (push) Failing after 8m29s
Docker / build-and-test-image (push) Failing after 11m32s
Employers working - onboarding to card print
2026-01-15 11:37:50 -05:00

27 lines
667 B
Ruby

class ImageProcessor
def initialize(image_path, new_filename = nil)
@image_path = image_path
@new_filename = new_filename
end
def call
if @new_filename
filename = @new_filename
else
filename = File.basename(@image_path)
end
binary_data = File.binread(@image_path)
# binary_data = File.open(@image_path, 'rb').read
meme_type = Marcel::MimeType.for Pathname.new(@image_path)
CardLogoFile.create(
filename: filename,
image_data: binary_data,
content_type: meme_type,
logo_type: "network"
)
end
end