WIP Store avatars as ActiveStorage attachments
All checks were successful
continuous-integration/drone/push Build is passing
continuous-integration/drone/pr Build is passing

Also push to LDAP as jpegPhoto
This commit is contained in:
2025-05-11 18:43:21 +04:00
parent 9e2210c45b
commit 17ffbde03a
8 changed files with 80 additions and 42 deletions

View File

@@ -95,8 +95,8 @@
<tr>
<th>Avatar</th>
<td>
<% if @avatar.present? %>
<img src="data:image/jpeg;base64,<%= @avatar %>" class="h-48 w-48" />
<% if @ldap_avatar.present? %>
JPEG size: <%= @ldap_avatar.size %>
<% else %>
&mdash;
<% end %>

View File

@@ -33,22 +33,19 @@
<% if Flipper.enabled?(:avatar_upload, current_user) %>
<label class="block">
<p class="font-bold mb-1">
Avatar
</p>
<p class="text-gray-500">
Default profile picture
</p>
<p class="font-bold mb-1">Avatar</p>
<p class="text-gray-500">Default profile picture</p>
<div class="flex items-center gap-6">
<% unless current_user.avatar.nil? %>
<p class="flex-none">
<%= image_tag "data:image/jpeg;base64,#{current_user.avatar_base64}",
class: "h-24 w-24 rounded-lg" %>
</p>
<% if @user.avatar.attached? %>
<p class="flex-none">
<%= image_tag @user.avatar_variant(size: :medium),
class: "h-24 w-24 rounded-lg" %>
</p>
<% end %>
<div class="grow">
<p class="mb-2">
<%= f.file_field :avatar, class: "" %>
<%= f.file_field :avatar_new, accept: "image/jpeg,image/png" %>
</p>
<p class="text-sm text-gray-500">
JPEG or PNG image, not larger than 1 megabyte
</p>