[main] Imagesizes in slider
All checks were successful
Build, Push, and Deploy to Nomad / docker-nomad (push) Successful in 53s

This commit is contained in:
2024-12-29 18:12:24 +01:00
parent e5960232f1
commit 10de61cb25
13 changed files with 29 additions and 15 deletions

View File

@@ -4,7 +4,8 @@ import markdown
from fastapi import FastAPI
from jinja2 import Environment, DictLoader
from markupsafe import Markup
from .image_service import ImageService
from .image_service import ImageService, FileHandler
class MarkdownRenderer:
def __init__(self, file_path: str = None, app: FastAPI=None):
@@ -88,18 +89,21 @@ class MarkdownRenderer:
html_content.append('<div class="button-stack">')
for i, val in enumerate(images):
self.image_service = ImageService( self.app )
print(val)
modal_id_current = f"{modal_id}_{i}"
modal_id_next = f"{modal_id}_{i + 1}" if i + 1 < len(images) else f"{modal_id}_0"
category = FileHandler().get_category(self.file_path)
thumbnal_img = self.image_service.image_tag(category = category, image_type = "thumbnails",filename = val,alt="A better description later on")
modal_img = self.image_service.image_tag(category = category, image_type = "large",filename = val,alt="A better description later on")
html_content.append(f"""
<button onclick="openModal('modal{modal_id_current}')" class="stacked-button">
<img src="{val}" alt="Image {i}" class="thumbnail" loading="lazy">
{thumbnal_img}
</button>
<div class="modal" id="modal{modal_id_current}">
<div class="modal-content">
<h2>Modal {i}</h2>
<img src="{val}" alt="Image {i}" loading="lazy">
{modal_img}
<div class="modal-buttons">
<button onclick="closeModal('modal{modal_id_current}')">Close</button>
@@ -136,9 +140,8 @@ class MarkdownRenderer:
width=width,
height=height
)
my_tag = Markup(tag)
print(my_tag)
return my_tag
return Markup(tag)