Loading resources/views.py +5 −3 Original line number Diff line number Diff line Loading @@ -11,6 +11,7 @@ import tempfile from resources.models import File import os.path from typing import Union from jama import settings def thumb( Loading @@ -34,9 +35,8 @@ def thumb( tmp_pic_path = "{}/thumb-{}-{}-{}-{}-{}-{}-{}.jpg".format( tempfile.gettempdir(), sha256, angle, scale, top, right, bottom, left ) # if not os.path.isfile(tmp_pic_path): if True: crop_color = [224, 224, 224] if not os.path.isfile(tmp_pic_path): crop_color = [96, 96, 96] img = pyvips.Image.new_from_file(pic_file.local_path()) if angle: img = img.rotate(angle) Loading @@ -54,5 +54,7 @@ def thumb( def test(request: HttpRequest) -> HttpResponse: if not settings.DEBUG: return HttpResponseNotFound("Not Found") f = File.objects.filter(file_type__mime__contains="image/").last() return render(request, "resources/test.html", {"hash": f.hash}) Loading
resources/views.py +5 −3 Original line number Diff line number Diff line Loading @@ -11,6 +11,7 @@ import tempfile from resources.models import File import os.path from typing import Union from jama import settings def thumb( Loading @@ -34,9 +35,8 @@ def thumb( tmp_pic_path = "{}/thumb-{}-{}-{}-{}-{}-{}-{}.jpg".format( tempfile.gettempdir(), sha256, angle, scale, top, right, bottom, left ) # if not os.path.isfile(tmp_pic_path): if True: crop_color = [224, 224, 224] if not os.path.isfile(tmp_pic_path): crop_color = [96, 96, 96] img = pyvips.Image.new_from_file(pic_file.local_path()) if angle: img = img.rotate(angle) Loading @@ -54,5 +54,7 @@ def thumb( def test(request: HttpRequest) -> HttpResponse: if not settings.DEBUG: return HttpResponseNotFound("Not Found") f = File.objects.filter(file_type__mime__contains="image/").last() return render(request, "resources/test.html", {"hash": f.hash})