changement et ajouts des thumb pour chargement plus rapide

This commit is contained in:
2026-08-01 18:32:38 +02:00
parent 25edd4fac7
commit 470f60ed04
4 changed files with 24 additions and 16 deletions
+1
View File
@@ -372,3 +372,4 @@ FodyWeavers.xsd
/PhotoShareDb/Migrations/PhotoShareDbContextModelSnapshot.cs /PhotoShareDb/Migrations/PhotoShareDbContextModelSnapshot.cs
/photoshare.tar /photoshare.tar
/testphotoshare.tar /testphotoshare.tar
/PhotoShareHelri/wwwroot/Photos/Bapteme2026
+3 -6
View File
@@ -8,16 +8,13 @@ namespace ModelsLib
{ {
} }
public PhotoUnit(string photoName, string photoPath,bool isSelected) public PhotoUnit(string photoPath)
{ {
PhotoName = photoName; Thumb = photoPath.Insert(photoPath.LastIndexOf("\\") + 1, "thumb\\");
PhotoPath = photoPath; PhotoPath = photoPath;
IsSelected = isSelected;
} }
public string PhotoName { get; set; } public string Thumb { get; set; }
public bool IsSelected { get; set; }
public string PhotoPath { get; set; } public string PhotoPath { get; set; }
@@ -25,17 +25,18 @@
<MudGrid Justify="Justify.Center" Spacing="3"> <MudGrid Justify="Justify.Center" Spacing="3">
@for (int index = 0; index < Images.Count; index++) @for (int index = 0; index < Images.Count; index++)
{ {
var img = Images[index]; var img = ListImages[index];
<MudItem xs="12" sm="6" md="4" lg="3" xl="2"> <MudItem xs="12" sm="6" md="4" lg="3" xl="2">
<MudPaper Class="image-card pa-2 position-relative" Elevation="2"> <MudPaper Class="image-card pa-2 position-relative" Elevation="2">
<MudImage Src="@img" <MudImage Src="@img.Thumb"
Alt="Photo sélection" Alt="Photo sélection"
Class="gallery-thumb" Class="gallery-thumb"
Fluid="true" Fluid="true"
@onclick="() => OpenModalZoom(img)" /> loading="lazy"
@onclick="() => OpenModalZoom(img.PhotoPath)" />
</MudPaper> </MudPaper>
</MudItem> </MudItem>
} }
@@ -69,6 +70,7 @@
// Liste des images disponibles // Liste des images disponibles
private List<string> Images = new(); private List<string> Images = new();
private List<PhotoUnit> ListImages = new();
public string Title { get; set; } public string Title { get; set; }
bool IsModalZoomOpen = false; bool IsModalZoomOpen = false;
@@ -135,7 +137,10 @@
ShootingId = id; ShootingId = id;
Images = ShootingDb.LireContenu(ShootingId, true); Images = ShootingDb.LireContenu(ShootingId, true);
foreach (var img in Images)
{
ListImages.Add(new PhotoUnit(img));
}
} }
} }
@@ -40,24 +40,24 @@
<MudGrid Justify="Justify.Center" Spacing="3"> <MudGrid Justify="Justify.Center" Spacing="3">
@for (int index = 0; index < Images.Count; index++) @for (int index = 0; index < Images.Count; index++)
{ {
var img = Images[index]; var img = ListImages[index];
var isSelected = SelectedImages.Contains(img); var isSelected = SelectedImages.Contains(img.PhotoPath);
var buttonClass = $"select-icon-btn {(isSelected ? "selected" : "not-selected")}"; var buttonClass = $"select-icon-btn {(isSelected ? "selected" : "not-selected")}";
<MudItem xs="12" sm="6" md="4" lg="3" xl="2"> <MudItem xs="12" sm="6" md="4" lg="3" xl="2">
<MudPaper Class="image-card pa-2 position-relative" Elevation="2"> <MudPaper Class="image-card pa-2 position-relative" Elevation="2">
<MudImage Src="@img" <MudImage Src="@img.Thumb"
Alt="Photo sélection" Alt="Photo sélection"
Class="gallery-thumb" Class="gallery-thumb"
Fluid="true" Fluid="true"
@onclick="() => OpenModalZoom(img)" /> @onclick="() => OpenModalZoom(img.PhotoPath)" />
<div @onclick:stopPropagation="true"> <div @onclick:stopPropagation="true">
<MudIconButton Icon="@(isSelected? Icons.Material.Filled.Check : Icons.Material.Outlined.RadioButtonUnchecked)" <MudIconButton Icon="@(isSelected? Icons.Material.Filled.Check : Icons.Material.Outlined.RadioButtonUnchecked)"
Class="@buttonClass" Class="@buttonClass"
Disabled="@(SelectedImages.Count >= MaxSelect && !isSelected)" Disabled="@(SelectedImages.Count >= MaxSelect && !isSelected)"
OnClick="() => ToggleImage(img)" /> OnClick="() => ToggleImage(img.PhotoPath)" />
</div> </div>
</MudPaper> </MudPaper>
@@ -102,7 +102,7 @@
// Liste des images disponibles // Liste des images disponibles
private List<string> Images = new(); private List<string> Images = new();
private List<PhotoUnit> ListImages = new();
public string Title { get; set; } public string Title { get; set; }
bool IsModalZoomOpen = false; bool IsModalZoomOpen = false;
string? CurrentImage; string? CurrentImage;
@@ -171,8 +171,13 @@
ShootingId = id; ShootingId = id;
Images = ShootingDb.LireContenu(ShootingId); Images = ShootingDb.LireContenu(ShootingId);
foreach (var img in Images)
{
ListImages.Add(new PhotoUnit(img));
}
} }
MaxSelect = Datas.MaxChoice;
Title = "Résultat du shooting " + Datas.Key; Title = "Résultat du shooting " + Datas.Key;
} }
} }