Commit 46049e85 authored by Sébastiaan Versteeg's avatar Sébastiaan Versteeg
Browse files

Resize uploaded photo to 1920x1080

parent a6bde094
......@@ -3,6 +3,8 @@ from django.conf import settings
from django.utils.functional import cached_property
from django.db import models
from PIL import Image
import hashlib
import os
import random
......@@ -27,6 +29,14 @@ class Photo(models.Model):
def __str__(self):
def save(self, *args, **kwargs):
super(Photo, self).save(*args, **kwargs)
image_path = str(self.file.path)
image =
image.thumbnail((1920, 1080), Image.ANTIALIAS), "JPEG")
class Album(models.Model):
title = models.CharField(max_length=200)
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment