Do not use ActiveStorage variants, process original avatar
All checks were successful
continuous-integration/drone/push Build is passing
continuous-integration/drone/pr Build is passing

Variants are currently broken. So we process the original file with the
most common avatar dimensions and stripping metadata, then hash and
upload only that version.
This commit is contained in:
2025-05-14 14:42:03 +04:00
parent 1884f082ee
commit 417e346074
5 changed files with 53 additions and 35 deletions

View File

@@ -14,15 +14,16 @@ module LdapManager
end
img_data = @user.avatar.blob.download
jpg_data = process(img_data)
jpg_data = process_avatar
Rails.logger.debug { "Storing new jpegPhoto for user #{@user.cn} in LDAP" }
result = replace_attribute(@dn, :jpegPhoto, jpg_data)
result == 0
end
private
def process(data)
def process_avatar
@user.avatar.blob.open do |file|
processed = ImageProcessing::Vips
.source(file)