generated from hjess/PythonTemplateProject
[main] Images images images
All checks were successful
Build, Push, and Deploy to Nomad / docker-nomad (push) Successful in 52s
All checks were successful
Build, Push, and Deploy to Nomad / docker-nomad (push) Successful in 52s
This commit is contained in:
Binary file not shown.
@@ -60,7 +60,7 @@ class Application:
|
||||
self.app.state.IMAGE_SIZES = {
|
||||
'thumbnails': {'width': 150, 'height': 150},
|
||||
'large': {'width': 800, 'height': 600},
|
||||
'small': {'width': 300, 'height': 200},
|
||||
'small': {'width': 300, 'height': 300},
|
||||
'original': {'width': None, 'height': None}, # Original størrelse
|
||||
}
|
||||
|
||||
|
||||
Binary file not shown.
Binary file not shown.
@@ -156,7 +156,7 @@ class ImageService:
|
||||
return FileResponse( file_path )
|
||||
|
||||
def image_tag(self, category: str, image_type: str, filename: str, alt: str = "", width: int = None,
|
||||
height: int = None) -> str:
|
||||
height: int = None,css_class:str=None) -> str:
|
||||
"""
|
||||
Generate an HTML <img> tag with default sizes if dimensions are not provided.
|
||||
"""
|
||||
@@ -172,6 +172,9 @@ class ImageService:
|
||||
tag += f' width="{width}"'
|
||||
if height:
|
||||
tag += f' height="{height}"'
|
||||
if css_class:
|
||||
tag += f' class="{css_class}"'
|
||||
|
||||
tag += ">"
|
||||
|
||||
return tag
|
||||
@@ -123,7 +123,7 @@ class MarkdownRenderer:
|
||||
return True
|
||||
|
||||
|
||||
def get_image(self, image_type: str, filename: str, alt: str = "", width: int = None, height: int = None) -> Markup:
|
||||
def get_image(self, image_type: str, filename: str, alt: str = "", width: int = None, height: int = None,css_class:str=None) -> Markup:
|
||||
"""
|
||||
Generate a dynamic HTML <img> tag for an image using ImageService's image_tag method.
|
||||
"""
|
||||
@@ -138,7 +138,8 @@ class MarkdownRenderer:
|
||||
filename=filename,
|
||||
alt=alt,
|
||||
width=width,
|
||||
height=height
|
||||
height=height,
|
||||
css_class=css_class
|
||||
)
|
||||
return Markup(tag)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user