Add custom emoji size recording and publish api

This commit is contained in:
KMY 2023-03-08 16:32:38 +09:00
parent 47bedd20ca
commit 92df4674ff
6 changed files with 36 additions and 2 deletions

View file

@ -1,5 +1,7 @@
# frozen_string_literal: true
require 'fastimage'
module Admin
class CustomEmojisController < BaseController
def index
@ -18,7 +20,11 @@ module Admin
def create
authorize :custom_emoji, :create?
image_size = FastImage.size(params[:custom_emoji][:image])
@custom_emoji = CustomEmoji.new(resource_params)
@custom_emoji.image_width = image_size[0]
@custom_emoji.image_height = image_size[1]
if @custom_emoji.save
log_action :create, @custom_emoji