mirror of
https://github.com/Derpy-Leggies/OnlyLegs.git
synced 2025-06-29 11:36:16 +00:00
Add EXIF data displaying
Add info to setup and manifest(o) Change background scroll effect
This commit is contained in:
parent
44a6712b6e
commit
8c25779882
10 changed files with 74 additions and 27 deletions
|
@ -5,6 +5,8 @@ from gallery.auth import login_required
|
|||
from gallery.db import get_db
|
||||
import os
|
||||
import datetime
|
||||
from PIL import Image
|
||||
from PIL.ExifTags import TAGS
|
||||
dt = datetime.datetime.now()
|
||||
|
||||
blueprint = Blueprint('gallery', __name__)
|
||||
|
@ -23,16 +25,29 @@ def index():
|
|||
@blueprint.route('/image/<int:id>')
|
||||
def image(id):
|
||||
db = get_db()
|
||||
post = db.execute(
|
||||
image = db.execute(
|
||||
'SELECT * FROM posts'
|
||||
' WHERE id = ?',
|
||||
(id,)
|
||||
).fetchone()
|
||||
|
||||
if post is None:
|
||||
if image is None:
|
||||
abort(404)
|
||||
|
||||
return render_template('image.html', fileName=post['file_name'], id=id)
|
||||
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)
|
||||
|
||||
if isinstance(value, bytes):
|
||||
value = value.decode()
|
||||
|
||||
human_exif[name] = value
|
||||
|
||||
return render_template('image.html', image=image, exif=human_exif)
|
||||
|
||||
|
||||
@blueprint.route('/group')
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue