1
0
mirror of https://gitlab.crans.org/bde/nk20 synced 2024-12-23 07:52:23 +00:00

Merge branch 'master' into 'fix_signin'

# Conflicts:
#   note_kfet/settings/development.py
This commit is contained in:
ynerant 2020-03-07 18:21:56 +01:00
commit 099c761321
3 changed files with 7 additions and 5 deletions

View File

@ -238,17 +238,18 @@ class ProfilePictureUpdateView(LoginRequiredMixin, FormMixin, DetailView):
h = form.cleaned_data['height']
# image crop and resize
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.crop((x, y, x+w, y+h))
image_clean = image.resize((settings.PIC_WIDTH,
settings.PIC_RATIO*settings.PIC_WIDTH),
Image.ANTIALIAS)
image_file = io.BytesIO()
image_clean.save(image_file,ext)
image_clean.save(image_file,"PNG")
image_field.file = image_file
# renaming
filename = "{}_pic.{}".format(self.object.note.pk, ext)
filename = "{}_pic.png".format(self.object.note.pk)
image_field.name = filename
self.object.note.display_image = image_field
self.object.note.save()

View File

@ -9,7 +9,7 @@ server {
# the port your site will be served on
listen 80;
# 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;
# max upload size

View File

@ -51,9 +51,10 @@ SESSION_COOKIE_AGE = 60 * 60 * 3
# CAS Client settings
# 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
STATICFILES_DIRS = [
os.path.join(BASE_DIR, 'static')]