diff --git a/app/services/__pycache__/image_service.cpython-312.pyc b/app/services/__pycache__/image_service.cpython-312.pyc
index d070e84..146cc59 100644
Binary files a/app/services/__pycache__/image_service.cpython-312.pyc and b/app/services/__pycache__/image_service.cpython-312.pyc differ
diff --git a/app/services/__pycache__/markdown_render.cpython-312.pyc b/app/services/__pycache__/markdown_render.cpython-312.pyc
index b291ff4..33dc111 100644
Binary files a/app/services/__pycache__/markdown_render.cpython-312.pyc and b/app/services/__pycache__/markdown_render.cpython-312.pyc differ
diff --git a/app/services/image_service.py b/app/services/image_service.py
index ebf07f4..88c19e6 100644
--- a/app/services/image_service.py
+++ b/app/services/image_service.py
@@ -7,9 +7,10 @@ from PIL import Image
class FileHandler:
- def __init__(self, category, image_type, filename):
+ def __init__(self, category=None, image_type=None, filename=None):
self.filename = filename
self.category = category
+
self.image_type = image_type
@property
@@ -44,6 +45,20 @@ class FileHandler:
f")"
)
+ def get_category(self, file_path):
+ # List all categories in the data directory
+ categories = [
+ name for name in os.listdir( "data/" )
+ if os.path.isdir( os.path.join( "data/", name ) )
+ ]
+
+ # Search for the category in the file path
+ for category in categories:
+ if f"/{category}/" in file_path or f"\\{category}\\" in file_path:
+ return category
+
+ # Return None if no category matches
+ return None
class ImageService:
@@ -139,14 +154,10 @@ class ImageService:
default_size = self.get_image_size( image_type)
width = width or default_size.get( "width" )
height = height or default_size.get( "height" )
-
-
-
- #file_path = self._resolve_path( category, image_type, filename )
file_path = FileHandler(category = category,image_type = image_type,filename = filename)
self.validate_image( file_path, width = width,height=height, overwrite = True )
- tag = f'')
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"""