diff --git a/gallery/__init__.py b/gallery/__init__.py index c7a40f9..7f4c6b1 100644 --- a/gallery/__init__.py +++ b/gallery/__init__.py @@ -5,21 +5,13 @@ print(""" | |_| | | | | | |_| | |__| __/ (_| \\__ \\ \\___/|_| |_|_|\\__, |_____\\___|\\__, |___/ |___/ |___/ -Created by Fluffy Bean - Version 140123 +Created by Fluffy Bean - Version 170123 """) -# Import base packages -import time -import sys -import os -import yaml - -# Import flask -from flask import * -from werkzeug.utils import secure_filename - -# Import dotenv +from flask import Flask, render_template from dotenv import load_dotenv +import yaml +import os def create_app(test_config=None): # create and configure the app @@ -27,6 +19,7 @@ def create_app(test_config=None): # Get environment variables load_dotenv(os.path.join(app.root_path, 'user', '.env')) + print("Loaded env") # Get config file with open(os.path.join(app.root_path, 'user', 'conf.yml'), 'r') as f: diff --git a/gallery/api.py b/gallery/api.py index 453405b..6ab06ea 100644 --- a/gallery/api.py +++ b/gallery/api.py @@ -24,11 +24,13 @@ def uploads(file, quality): img = Image.open(os.path.join(current_app.config['UPLOAD_FOLDER'], secure_filename(file))) img_ext = os.path.splitext(secure_filename(file))[-1].lower().replace('.', '') img_ext = set_ext[img_ext] + img_icc = img.info.get("icc_profile") # Get ICC profile as it alters colours # Resize image and orientate correctly img.thumbnail((quality, quality), Image.LANCZOS) img = ImageOps.exif_transpose(img) - img.save(buff, img_ext) + img.save(buff, img_ext, icc_profile=img_icc) + img.close() # Seek to beginning of buffer and return buff.seek(0) diff --git a/gallery/image.py b/gallery/image.py index 4f31706..e2664cd 100644 --- a/gallery/image.py +++ b/gallery/image.py @@ -25,7 +25,7 @@ def image(id): # Get exif data from image try: - file = Image.open(os.path.join(current_app.config['UPLOAD_FOLDER'], 'original', image['file_name'])) + file = Image.open(os.path.join(current_app.config['UPLOAD_FOLDER'], image['file_name'])) raw_exif = file.getexif() human_exif = {} diff --git a/gallery/templates/auth/login.html b/gallery/templates/auth/login.html index 7287d9f..6a83515 100644 --- a/gallery/templates/auth/login.html +++ b/gallery/templates/auth/login.html @@ -1,24 +1,43 @@ {% extends 'layout.html' %} {% block header %} - leaves + {% endblock %} {% block content %}
-

Login

-
-
- - - - - -
- - {% for message in get_flashed_messages() %} -
{{ message }}
- {% endfor %} +
{% endblock %} \ No newline at end of file diff --git a/gallery/templates/auth/register.html b/gallery/templates/auth/register.html index e62ddc1..98a788f 100644 --- a/gallery/templates/auth/register.html +++ b/gallery/templates/auth/register.html @@ -1,24 +1,43 @@ {% extends 'layout.html' %} {% block header %} - leaves + {% endblock %} {% block content %}
-

register

-
-
- - - - - -
- - {% for message in get_flashed_messages() %} -
{{ message }}
- {% endfor %} +
+
+ + + +

Register

+
+
+ {% for message in get_flashed_messages() %} +
{{ message }}
+ {% endfor %} + +
+ + + + + + + + + + + + + + + +
+ + Login +
{% endblock %} \ No newline at end of file diff --git a/gallery/templates/error.html b/gallery/templates/error.html index 8b877dd..42f157a 100644 --- a/gallery/templates/error.html +++ b/gallery/templates/error.html @@ -1,7 +1,7 @@ {% extends 'layout.html' %} {% block header %} - + {% endblock %} {% block content %} diff --git a/gallery/templates/image.html b/gallery/templates/image.html index 1af5e42..89d773d 100644 --- a/gallery/templates/image.html +++ b/gallery/templates/image.html @@ -8,7 +8,7 @@
@@ -20,6 +20,8 @@ src="/api/uploads/{{ image['file_name'] }}/1000" onload="imgFade(this)" style="opacity:0;" onerror="this.src='/static/images/error.png'" + width="{{ file['width'] }}" + height="{{ file['height'] }}" />
@@ -122,29 +124,23 @@ {% endif %}
diff --git a/gallery/templates/upload.html b/gallery/templates/upload.html index 4bde0a3..3550188 100644 --- a/gallery/templates/upload.html +++ b/gallery/templates/upload.html @@ -6,31 +6,46 @@ {% block content %}
-

Upload!!!!!

-
-
- - - - +
+
+ + + +

Upload!!!!!!!

+
+
+ + + + + + + + + + + + + - - - - - - - - - + + + + + + - - - - - - + + + + + + + + + +