mirror of
https://github.com/LD-Reborn/Berufsschule_HAM.git
synced 2025-12-20 06:51:55 +00:00
Fixed images in Users view
This commit is contained in:
@@ -3,6 +3,7 @@ using Berufsschule_HAM.Services;
|
|||||||
using Microsoft.AspNetCore.Mvc;
|
using Microsoft.AspNetCore.Mvc;
|
||||||
using Novell.Directory.Ldap;
|
using Novell.Directory.Ldap;
|
||||||
using Berufsschule_HAM.Models;
|
using Berufsschule_HAM.Models;
|
||||||
|
using Berufsschule_HAM.Helpers;
|
||||||
using System.Security.Cryptography;
|
using System.Security.Cryptography;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
using Microsoft.AspNetCore.Authorization;
|
using Microsoft.AspNetCore.Authorization;
|
||||||
@@ -63,7 +64,7 @@ public class UsersController : Controller
|
|||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
jpegPhoto ??= System.IO.File.ReadAllText("wwwroot/user_default.jpeg"); // TODO: cleanup - make this a config setting
|
jpegPhoto ??= Convert.ToBase64String(System.IO.File.ReadAllBytes("wwwroot/user_default.jpeg")); // TODO: cleanup - make this a config setting
|
||||||
uid ??= sn.ToLower() + cn.ToLower();
|
uid ??= sn.ToLower() + cn.ToLower();
|
||||||
title ??= "";
|
title ??= "";
|
||||||
description ??= "{}";
|
description ??= "{}";
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
using System.Text.RegularExpressions;
|
using System.Text.RegularExpressions;
|
||||||
|
using System.Text;
|
||||||
|
|
||||||
namespace Berufsschule_HAM.Helpers;
|
namespace Berufsschule_HAM.Helpers;
|
||||||
|
|
||||||
@@ -16,4 +17,9 @@ public static class StringHelpers
|
|||||||
input = input.Trim('-');
|
input = input.Trim('-');
|
||||||
return input;
|
return input;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static string ToBase64String(string input)
|
||||||
|
{
|
||||||
|
return Convert.ToBase64String(Encoding.UTF8.GetBytes(input));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@@ -1,5 +1,6 @@
|
|||||||
@using Microsoft.AspNetCore.Mvc.Localization
|
@using Microsoft.AspNetCore.Mvc.Localization
|
||||||
@using Berufsschule_HAM.Models
|
@using Berufsschule_HAM.Models
|
||||||
|
@using System.Buffers.Text
|
||||||
@model UsersIndexViewModel
|
@model UsersIndexViewModel
|
||||||
@inject IViewLocalizer T
|
@inject IViewLocalizer T
|
||||||
@{
|
@{
|
||||||
@@ -20,7 +21,7 @@
|
|||||||
<table class="table table-striped align-middle">
|
<table class="table table-striped align-middle">
|
||||||
<thead>
|
<thead>
|
||||||
<tr>
|
<tr>
|
||||||
<th>User Photo</th>
|
<th style="width: 2rem;"></th>
|
||||||
<th>User ID</th>
|
<th>User ID</th>
|
||||||
<th>title</th>
|
<th>title</th>
|
||||||
<th>Name</th>
|
<th>Name</th>
|
||||||
@@ -34,7 +35,9 @@
|
|||||||
foreach (UserTableViewModel userTableViewModel in Model.UserTableViewModels)
|
foreach (UserTableViewModel userTableViewModel in Model.UserTableViewModels)
|
||||||
{
|
{
|
||||||
<tr>
|
<tr>
|
||||||
<td>@@userTableViewModel.JpegPhoto</td>
|
<td>
|
||||||
|
<img class="rounded-circle user-icon" src="data:image/jpeg;base64,@userTableViewModel.JpegPhoto" alt="Photo" style="max-width:300px;" />
|
||||||
|
</td>
|
||||||
<td>@userTableViewModel.Uid</td>
|
<td>@userTableViewModel.Uid</td>
|
||||||
<td>@userTableViewModel.Title</td>
|
<td>@userTableViewModel.Title</td>
|
||||||
<td>@userTableViewModel.Name</td>
|
<td>@userTableViewModel.Name</td>
|
||||||
|
|||||||
@@ -35,3 +35,9 @@ body {
|
|||||||
margin: 1rem 0 1rem 0;
|
margin: 1rem 0 1rem 0;
|
||||||
padding: 2rem 4rem 2rem 4rem;
|
padding: 2rem 4rem 2rem 4rem;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.user-icon {
|
||||||
|
width: 2rem;
|
||||||
|
height: 2rem;
|
||||||
|
float: right;
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user