master
parent
73e08cfdd6
commit
3af1d97d7a
|
@ -22,3 +22,7 @@ class PopeVersion(models.Model):
|
|||
class PerfectPope(models.Model):
|
||||
aspect_ratio = models.DecimalField(max_digits=6, decimal_places=decimal_places)
|
||||
pope = models.ForeignKey('Pope')
|
||||
|
||||
def __str__(self):
|
||||
|
||||
return str(self.aspect_ratio)
|
||||
|
|
|
@ -14,14 +14,15 @@ def index(request):
|
|||
|
||||
def conclave(request, width, height):
|
||||
width, height = int(width), int(height)
|
||||
if width > 0 and height > 0:
|
||||
aspect_ratio = width/height
|
||||
pope = select_best_pope(aspect_ratio)
|
||||
|
||||
|
||||
aspect_ratio = width/height
|
||||
pope = select_best_pope(aspect_ratio)
|
||||
|
||||
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")
|
||||
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")
|
||||
else:
|
||||
return HttpResponse("8====D~~~~")
|
||||
|
|
Loading…
Reference in New Issue