mirror of
https://github.com/Derpy-Leggies/OnlyLegs.git
synced 2025-06-29 11:36:16 +00:00
Yaml config files
Fixed some Sass issues No image... image Squished some bugs involving uploading broken files
This commit is contained in:
parent
978086f512
commit
5db8fa52e8
12 changed files with 193 additions and 56 deletions
|
@ -1,7 +1,6 @@
|
|||
from flask import Blueprint, flash, g, redirect, render_template, request, url_for, jsonify, current_app
|
||||
from werkzeug.exceptions import abort
|
||||
from werkzeug.utils import secure_filename
|
||||
from gallery.auth import login_required
|
||||
from gallery.db import get_db
|
||||
import os
|
||||
import datetime
|
||||
|
@ -63,21 +62,25 @@ def image(id):
|
|||
abort(404)
|
||||
|
||||
# Get exif data from image
|
||||
file = Image.open(os.path.join(current_app.config['UPLOAD_FOLDER'], 'original', image['file_name']))
|
||||
raw_exif = file.getexif()
|
||||
human_exif = {}
|
||||
|
||||
for tag in raw_exif:
|
||||
name = TAGS.get(tag, tag)
|
||||
value = raw_exif.get(tag)
|
||||
try:
|
||||
file = Image.open(os.path.join(current_app.config['UPLOAD_FOLDER'], 'original', image['file_name']))
|
||||
raw_exif = file.getexif()
|
||||
human_exif = {}
|
||||
|
||||
if isinstance(value, bytes):
|
||||
value = value.decode()
|
||||
for tag in raw_exif:
|
||||
name = TAGS.get(tag, tag)
|
||||
value = raw_exif.get(tag)
|
||||
|
||||
if isinstance(value, bytes):
|
||||
value = value.decode()
|
||||
|
||||
human_exif[name] = value
|
||||
|
||||
human_exif[name] = value
|
||||
|
||||
if len(human_exif) == 0:
|
||||
if len(human_exif) == 0:
|
||||
human_exif = False
|
||||
except:
|
||||
# Cringe, no file present
|
||||
human_exif = False
|
||||
|
||||
# All in le head
|
||||
return render_template('image.html', image=image, exif=human_exif)
|
||||
return render_template('image.html', image=image, exif=human_exif, file=file)
|
Loading…
Add table
Add a link
Reference in a new issue