mirror of
https://github.com/minetest/contentdb.git
synced 2025-01-10 23:17:37 +01:00
Increase thumbnail resolution
This commit is contained in:
parent
89f95a22dc
commit
bf5080aa18
@ -580,7 +580,7 @@ class PackageScreenshot(db.Model):
|
|||||||
id=self.id)
|
id=self.id)
|
||||||
|
|
||||||
def getThumbnailURL(self):
|
def getThumbnailURL(self):
|
||||||
return self.url.replace("/uploads/", "/thumbnails/332x221/")
|
return self.url.replace("/uploads/", "/thumbnails/350x233/")
|
||||||
|
|
||||||
class EditRequest(db.Model):
|
class EditRequest(db.Model):
|
||||||
id = db.Column(db.Integer, primary_key=True)
|
id = db.Column(db.Integer, primary_key=True)
|
||||||
|
@ -21,20 +21,21 @@ from app import app
|
|||||||
import glob, os
|
import glob, os
|
||||||
from PIL import Image
|
from PIL import Image
|
||||||
|
|
||||||
ALLOWED_RESOLUTIONS=[(332,221)]
|
ALLOWED_RESOLUTIONS=[(350,233)]
|
||||||
|
|
||||||
def mkdir(path):
|
def mkdir(path):
|
||||||
if not os.path.isdir(path):
|
if not os.path.isdir(path):
|
||||||
os.mkdir(path)
|
os.mkdir(path)
|
||||||
|
|
||||||
|
mkdir("app/public/thumbnails/")
|
||||||
|
|
||||||
@app.route("/thumbnails/<img>")
|
@app.route("/thumbnails/<img>")
|
||||||
@app.route("/thumbnails/<int:w>x<int:h>/<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:
|
if not (w, h) in ALLOWED_RESOLUTIONS:
|
||||||
abort(403)
|
abort(403)
|
||||||
|
|
||||||
mkdir("app/public/thumbnails/")
|
mkdir("app/public/thumbnails/{}x{}/".format(w, h))
|
||||||
mkdir("app/public/thumbnails/332x221/")
|
|
||||||
|
|
||||||
cache_filepath = "public/thumbnails/{}x{}/{}".format(w, h, img)
|
cache_filepath = "public/thumbnails/{}x{}/{}".format(w, h, img)
|
||||||
source_filepath = "public/uploads/" + img
|
source_filepath = "public/uploads/" + img
|
||||||
|
Loading…
Reference in New Issue
Block a user