commit dda9c09328f6a22f07ab226f84c08db7018e2be0 Author: Guamss Date: Mon Feb 23 00:05:32 2026 +0100 initial commit diff --git a/src/myalbum/.gitignore b/src/myalbum/.gitignore new file mode 100644 index 0000000..afc62cd --- /dev/null +++ b/src/myalbum/.gitignore @@ -0,0 +1 @@ +*.JPG \ No newline at end of file diff --git a/src/myalbum/__init__.py b/src/myalbum/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/src/myalbum/__pycache__/__init__.cpython-314.pyc b/src/myalbum/__pycache__/__init__.cpython-314.pyc new file mode 100644 index 0000000..1d58402 Binary files /dev/null and b/src/myalbum/__pycache__/__init__.cpython-314.pyc differ diff --git a/src/myalbum/__pycache__/app.cpython-314.pyc b/src/myalbum/__pycache__/app.cpython-314.pyc new file mode 100644 index 0000000..8b3bcac Binary files /dev/null and b/src/myalbum/__pycache__/app.cpython-314.pyc differ diff --git a/src/myalbum/__pycache__/models.cpython-314.pyc b/src/myalbum/__pycache__/models.cpython-314.pyc new file mode 100644 index 0000000..0ed7f3c Binary files /dev/null and b/src/myalbum/__pycache__/models.cpython-314.pyc differ diff --git a/src/myalbum/app.py b/src/myalbum/app.py new file mode 100755 index 0000000..f0061b3 --- /dev/null +++ b/src/myalbum/app.py @@ -0,0 +1,24 @@ +import os + +from flask import Flask, render_template +from PIL import Image +from os import listdir +from myalbum.models import Photo + +PHOTO_DIR = "./static" + +app = Flask(__name__) + +@app.route("/") +def hello_world(): + photos = [] + paths = listdir(PHOTO_DIR) + for path in paths: + img = Image.open(os.path.join(PHOTO_DIR, path)) + print(img.filename) + exif_data = img.getexif() + wid, hgt = img.size + brand = exif_data[271] + model = exif_data[272] + photos.append(Photo(path, str(wid) + "x" + str(hgt),brand, model)) + return render_template("index.html", photos=photos, str=str) \ No newline at end of file diff --git a/src/myalbum/models.py b/src/myalbum/models.py new file mode 100644 index 0000000..ebad0e7 --- /dev/null +++ b/src/myalbum/models.py @@ -0,0 +1,9 @@ +class Photo(): + def __init__(self, name: str, res: str, brand: str, model: str) -> None: + self.name = name + self.res = res + self.brand = brand + self.model = model + + def __str__(self) -> str: + return f"{self.name} {self.res}" \ No newline at end of file diff --git a/src/myalbum/templates/index.html b/src/myalbum/templates/index.html new file mode 100644 index 0000000..1a45bea --- /dev/null +++ b/src/myalbum/templates/index.html @@ -0,0 +1,14 @@ + + + + + + Document + + + {% for photo in photos %} + +

{{ str(photo) }}

+ {% endfor %} + + \ No newline at end of file