derp
parent
7797b2e8e9
commit
1bd15b9107
|
@ -3,6 +3,11 @@ from PIL import Image
|
|||
from os import path
|
||||
PREFIX = "popes"
|
||||
|
||||
|
||||
|
||||
def select_best_pope(width,height):
|
||||
return "papiez.jpg"
|
||||
|
||||
class PopeMaster:
|
||||
def __init__(self):
|
||||
pass
|
||||
|
|
|
@ -1,6 +1,9 @@
|
|||
# Create your views here.
|
||||
from django.shortcuts import render
|
||||
from django.http import HttpResponse
|
||||
from PIL import Image
|
||||
from io import BytesIO # FIXME:
|
||||
from papiezator.pope_utils import select_best_pope
|
||||
|
||||
|
||||
def index(request):
|
||||
|
@ -10,6 +13,14 @@ def index(request):
|
|||
pass
|
||||
|
||||
def conclave(request, width, height):
|
||||
width, height = int(width), int(height)
|
||||
|
||||
with open("papiez.jpg", "rb") as file:
|
||||
return HttpResponse(file.read(), mimetype="image/jpeg")
|
||||
|
||||
pope = select_best_pope(width, height)
|
||||
|
||||
im = Image.open(pope)
|
||||
im = im.resize((width, height))
|
||||
f = BytesIO()
|
||||
im.save(f, "jpeg")
|
||||
f.seek(0)
|
||||
return HttpResponse(f.read(), mimetype="image/jpeg")
|
||||
|
|
Loading…
Reference in New Issue