diff options
author | rubenwardy <rw@rubenwardy.com> | 2018-05-29 16:56:35 +0100 |
---|---|---|
committer | rubenwardy <rw@rubenwardy.com> | 2018-05-29 16:56:35 +0100 |
commit | bf5080aa18c7ea16f1144850c80d739d304498ae (patch) | |
tree | 561366ec5141e9821d4aecd615b065febde579e2 | |
parent | 89f95a22dc3f060470021f2fc3c13e4914f0871f (diff) | |
download | cheatdb-bf5080aa18c7ea16f1144850c80d739d304498ae.tar.xz |
Increase thumbnail resolution
-rw-r--r-- | app/models.py | 2 | ||||
-rw-r--r-- | app/views/thumbnails.py | 9 |
2 files changed, 6 insertions, 5 deletions
diff --git a/app/models.py b/app/models.py index b3a6d5a..9db01f2 100644 --- a/app/models.py +++ b/app/models.py @@ -580,7 +580,7 @@ class PackageScreenshot(db.Model): id=self.id) def getThumbnailURL(self): - return self.url.replace("/uploads/", "/thumbnails/332x221/") + return self.url.replace("/uploads/", "/thumbnails/350x233/") class EditRequest(db.Model): id = db.Column(db.Integer, primary_key=True) diff --git a/app/views/thumbnails.py b/app/views/thumbnails.py index d33e74c..99b9fde 100644 --- a/app/views/thumbnails.py +++ b/app/views/thumbnails.py @@ -21,20 +21,21 @@ from app import app import glob, os from PIL import Image -ALLOWED_RESOLUTIONS=[(332,221)] +ALLOWED_RESOLUTIONS=[(350,233)] def mkdir(path): if not os.path.isdir(path): os.mkdir(path) +mkdir("app/public/thumbnails/") + @app.route("/thumbnails/<img>") @app.route("/thumbnails/<int:w>x<int:h>/<img>") -def make_thumbnail(img, w=332, h=221): +def make_thumbnail(img, w=350, h=233): if not (w, h) in ALLOWED_RESOLUTIONS: abort(403) - mkdir("app/public/thumbnails/") - mkdir("app/public/thumbnails/332x221/") + mkdir("app/public/thumbnails/{}x{}/".format(w, h)) cache_filepath = "public/thumbnails/{}x{}/{}".format(w, h, img) source_filepath = "public/uploads/" + img |