diff --git a/library/csvparser/varlib.csv b/library/csvparser/varlib.csv index b140e3c..64b14f7 100644 --- a/library/csvparser/varlib.csv +++ b/library/csvparser/varlib.csv @@ -53,4 +53,4 @@ Id,Publication,Author,Year,Custodian,Fields,Type,Publishers,License,LicenseShort 61,Mots de la cage aux ours - woorden uit de berenkuil,Constant,2012,Varia,"words, language, Bruxelles",Softcover,Constant,Copyleft,Copyleft,,, 62,Snake rituals and switching circuits,Florian Cramer,2009,Danny,"mass communication, personal communication, new media",paperback,Piet Zwart Institute,Creative Commons Attribution-Share Alike 3.0,Creative Commons,The function of a medium is ultimately decided by its users and not by its creators,, 63,Magium issue 1: On Eating in isolation,Alice Strete,2020,Varia,"food, sharing, personal stories, consumption",zine,Self Published,Free Art License,Free Art License,,,No one -64,Networks of One's Own: three takes on taking care,"Varia, Constant and Colm O’Neill",2019,Varia,"Software, internet, taking care, homebrew",paperback,Varia,Copyleft,Copyleft,,Networks Of One’s Own is a periodic para-nodal1 publication that is itself collectively within a network2., +64,Networks of One's Own 2: three takes on taking care,"Varia, Constant and Colm O’Neill",2019,Danny,"Software, internet, taking care, homebrew",paperback,Varia,Copyleft,Copyleft,Networks Of One’s Own is a periodic para-nodal publication that is itself collectively within a network.,,Danny diff --git a/library/page.py b/library/page.py index 81c7acf..b78037b 100644 --- a/library/page.py +++ b/library/page.py @@ -14,6 +14,7 @@ from flask import ( ) from flask_wtf.csrf import CSRFProtect from werkzeug.utils import secure_filename +from PIL import Image from rnrfeed.rnrfeeder import getevents, getlatestevent from uploadform import PublicationForm from borrowform import BorrowForm @@ -31,6 +32,7 @@ from csvparser.csvparser import ( csrf = CSRFProtect() APP = flask.Flask(__name__, static_folder="static") APP.config['SECRET_KEY'] = 'ty4425hk54a21eee5719b9s9df7sdfklx' +APP.config['UPLOAD_FOLDER'] = 'tmpupload' csrf.init_app(APP) @@ -128,9 +130,16 @@ def upcoming_or_latest(): def saveimage(image, id): """helper function that can save images""" - print(image.filename) + image.save(os.path.join(APP.config['UPLOAD_FOLDER'], image.filename)) + orig_image = Image.open( + os.path.join(APP.config['UPLOAD_FOLDER'] ,image.filename) + ) + new_width = 640 + new_height = int(new_width * orig_image.height / orig_image.width) + resized_image = orig_image.resize((new_width, new_height), Image.ANTIALIAS) filename = secure_filename("image-{0}.jpg".format(id)) - image.save(os.path.join("static/images/", filename)) + resized_image.save(os.path.join("static/images/", filename)) + os.remove(os.path.join(APP.config['UPLOAD_FOLDER'], image.filename)) def checksecret(secret): diff --git a/library/static/images/image-64.jpg b/library/static/images/image-64.jpg index eb52401..200256a 100644 Binary files a/library/static/images/image-64.jpg and b/library/static/images/image-64.jpg differ diff --git a/requirements.txt b/requirements.txt index f144509..ab4e9d7 100644 --- a/requirements.txt +++ b/requirements.txt @@ -3,4 +3,5 @@ feedparser flask flask_wtf requests +Pillow bcrypt