# Copyright (C) 2012-2024 Zammad Foundation, https://zammad-foundation.org/ module Service class SystemAssets class ProductLogo PRODUCT_LOGO_RESIZED = 2 PRODUCT_LOGO_RAW = 1 PRODUCT_LOGO_FIT_WIDTH = 200 PRODUCT_LOGO_FIT_HEIGHT = 100 def self.sendable_asset if (asset = custom_logo) return SendableAsset.new( content: asset.content, filename: asset.filename, type: asset.preferences['Content-Type'] ) end SendableAsset.new( content: Rails.public_path.join('assets/images/logo.svg').read, filename: 'logo.svg', type: 'image/svg+xml' ) end def self.store_logo(file) clear_all store_one PRODUCT_LOGO_RAW, file, 'logo_raw' Time.current.to_i end def self.store(logo, logo_resize = nil) # rubocop:disable Metrics/CyclomaticComplexity,Metrics/PerceivedComplexity return if !logo && !logo_resize if logo&.match?(%r{ file[:mime_type] }, created_by_id: 1, ) end private_class_method :store_one end end end