Files
baclight/app/controllers/card_logo_files_controller.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

57 lines
1.3 KiB
Ruby

class CardLogoFilesController < ApplicationController
def index
end
def show
end
def image
logo_file = CardLogoFile.find_by(filename: params[:id])
puts params[:id]
logo_binary = logo_file.image_data
logo_filename = logo_file.filename
logo_file_type = logo_file.content_type
send_data logo_binary,
filename: logo_filename,
# type: logo_file_type,
disposition: 'inline'
end
def new
end
def create
file = card_logo_file_params["logo_file"]
if file.present? && file.is_a?(ActionDispatch::Http::UploadedFile)
filename = file.original_filename
# binary_data = file.read
binary_data = File.binread(file)
meme_type = Marcel::MimeType.for(file)
CardLogoFile.create(
filename: filename,
image_data: binary_data,
content_type: meme_type,
logo_type: card_logo_file_params["logo_type"]
)
end
end
def edit
end
def update
end
def destroy
end
private
def card_logo_file_params
params.require(:card_logo_file).permit(:logo_file, :logo_type)
end
end