Prod build process
This commit is contained in:
@@ -1,7 +1,9 @@
|
||||
module IdCard
|
||||
class EmployerLogo < ApplicationRecord
|
||||
# before_validation :resize_logo, if: :image_data_changed?
|
||||
# before_validation :calculate_aspect_ratio, if: :image_data_changed?
|
||||
belongs_to :setup, optional: true
|
||||
validates :filename, :image_data, :content_type, :aspect_ratio, presence: true
|
||||
validates :filename, uniqueness: true
|
||||
|
||||
before_validation :process_image, if: :image_data_changed?
|
||||
|
||||
private
|
||||
@@ -27,24 +29,5 @@ module IdCard
|
||||
end
|
||||
end
|
||||
|
||||
# def resize_logo
|
||||
# image = Vips::Image.new_from_buffer(self.image_data, "")
|
||||
|
||||
# processed_image = ImageProcessing::Vips
|
||||
# .source(image)
|
||||
# .resize_to_limit(nil, 200)
|
||||
# .call
|
||||
|
||||
# self.image_data = processed_image.read
|
||||
# end
|
||||
|
||||
# def calculate_aspect_ratio
|
||||
# image_io = StringIO.new(self.image_data)
|
||||
# width, height = FastImage.size(image_io)
|
||||
# image_ratio = width.to_f / height
|
||||
# if image_ratio
|
||||
# self.aspect_ratio = image_ratio.round(2)
|
||||
# end
|
||||
# end
|
||||
end
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user