mirror of https://gitlab.crans.org/bde/nk20
Merge branch 'master' into 'fix_signin'
# Conflicts: # note_kfet/settings/development.py
This commit is contained in:
commit
099c761321
|
@ -238,17 +238,18 @@ class ProfilePictureUpdateView(LoginRequiredMixin, FormMixin, DetailView):
|
||||||
h = form.cleaned_data['height']
|
h = form.cleaned_data['height']
|
||||||
# image crop and resize
|
# image crop and resize
|
||||||
image_file = io.BytesIO(image_field.read())
|
image_file = io.BytesIO(image_field.read())
|
||||||
ext = image_field.name.split('.')[-1]
|
ext = image_field.name.split('.')[-1].lower()
|
||||||
|
#TODO: support GIF format
|
||||||
image = Image.open(image_file)
|
image = Image.open(image_file)
|
||||||
image = image.crop((x, y, x+w, y+h))
|
image = image.crop((x, y, x+w, y+h))
|
||||||
image_clean = image.resize((settings.PIC_WIDTH,
|
image_clean = image.resize((settings.PIC_WIDTH,
|
||||||
settings.PIC_RATIO*settings.PIC_WIDTH),
|
settings.PIC_RATIO*settings.PIC_WIDTH),
|
||||||
Image.ANTIALIAS)
|
Image.ANTIALIAS)
|
||||||
image_file = io.BytesIO()
|
image_file = io.BytesIO()
|
||||||
image_clean.save(image_file,ext)
|
image_clean.save(image_file,"PNG")
|
||||||
image_field.file = image_file
|
image_field.file = image_file
|
||||||
# renaming
|
# renaming
|
||||||
filename = "{}_pic.{}".format(self.object.note.pk, ext)
|
filename = "{}_pic.png".format(self.object.note.pk)
|
||||||
image_field.name = filename
|
image_field.name = filename
|
||||||
self.object.note.display_image = image_field
|
self.object.note.display_image = image_field
|
||||||
self.object.note.save()
|
self.object.note.save()
|
||||||
|
|
|
@ -9,7 +9,7 @@ server {
|
||||||
# the port your site will be served on
|
# the port your site will be served on
|
||||||
listen 80;
|
listen 80;
|
||||||
# the domain name it will serve for
|
# the domain name it will serve for
|
||||||
server_name note.comby.xyz; # substitute your machine's IP address or FQDN
|
server_name note.example.org; # substitute your machine's IP address or FQDN
|
||||||
charset utf-8;
|
charset utf-8;
|
||||||
|
|
||||||
# max upload size
|
# max upload size
|
||||||
|
|
|
@ -51,9 +51,10 @@ SESSION_COOKIE_AGE = 60 * 60 * 3
|
||||||
|
|
||||||
# CAS Client settings
|
# CAS Client settings
|
||||||
# Can be modified in secrets.py
|
# Can be modified in secrets.py
|
||||||
CAS_SERVER_URL = "https://note.comby.xyz/cas/"
|
CAS_SERVER_URL = "http://localhost:8000/cas/"
|
||||||
|
|
||||||
|
|
||||||
STATIC_ROOT = '' # not needed in development settings
|
STATIC_ROOT = '' # not needed in development settings
|
||||||
STATICFILES_DIRS = [
|
STATICFILES_DIRS = [
|
||||||
os.path.join(BASE_DIR, 'static')]
|
os.path.join(BASE_DIR, 'static')]
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue