tweaked compression and upload limit
This commit is contained in:
parent
3fbd2ef032
commit
6a010587bf
@ -74,9 +74,15 @@ class Recipe(models.Model):
|
|||||||
|
|
||||||
def save(self, *args, **kwargs):
|
def save(self, *args, **kwargs):
|
||||||
if self.image:
|
if self.image:
|
||||||
im = Image.open(self.image)
|
img = Image.open(self.image)
|
||||||
|
|
||||||
|
basewidth = 720
|
||||||
|
wpercent = (basewidth / float(img.size[0]))
|
||||||
|
hsize = int((float(img.size[1]) * float(wpercent)))
|
||||||
|
img = img.resize((basewidth, hsize), Image.ANTIALIAS)
|
||||||
|
|
||||||
im_io = BytesIO()
|
im_io = BytesIO()
|
||||||
im.save(im_io, 'JPEG', quality=70)
|
img.save(im_io, 'JPEG', quality=70)
|
||||||
self.image = File(im_io, name=(str(self.pk)+'.jpeg'))
|
self.image = File(im_io, name=(str(self.pk)+'.jpeg'))
|
||||||
super().save(*args, **kwargs)
|
super().save(*args, **kwargs)
|
||||||
|
|
||||||
|
@ -1,6 +1,9 @@
|
|||||||
server {
|
server {
|
||||||
listen 80;
|
listen 80;
|
||||||
server_name localhost;
|
server_name localhost;
|
||||||
|
|
||||||
|
client_max_body_size 16m;
|
||||||
|
|
||||||
# serve static files
|
# serve static files
|
||||||
location /static/ {
|
location /static/ {
|
||||||
alias /static/;
|
alias /static/;
|
||||||
|
Loading…
Reference in New Issue
Block a user