module UserManager class ProcessAvatar < UserManagerService def initialize(io:) @io = io end def call processed = ImageProcessing::Vips .source(@io) .resize_to_fill(400, 400) .saver(strip: true) .call @io.rewind processed.read rescue Vips::Error => e Sentry.capture_exception(e) if Setting.sentry_enabled? Rails.logger.warn { "Image processing failed for avatar: #{e.message}" } nil end end end