@page "/gallery"
@code {
List imagePaths = new List();
string selectedImage;
string infoText = "Info Text";
string popupStyle = "display: none;";
protected override async Task OnInitializedAsync()
{
await base.OnInitializedAsync();
// Get the physical path to the folder
string folderPath = Path.Combine(_environment.WebRootPath, "generated_images");
if (Directory.Exists(folderPath))
{
// Load the image file names from the folder
var imageFiles = Directory.GetFiles(folderPath, "*.jpg");
// Get the relative paths to the images
imagePaths = imageFiles.Select(file => file.Replace(_environment.WebRootPath, "").Replace("\\", "/")).ToList();
}
}
private void ShowImageInfo(string imagePath)
{
selectedImage = imagePath;
infoText = "Info Text"; // Hier kannst du den gewünschten Infotext setzen
popupStyle = "display: block;";
}
private void CloseImageInfo()
{
popupStyle = "display: none;";
}
[Inject]
private IWebHostEnvironment _environment { get; set; }
}