mirror of
https://git.linux-kernel.at/oliver/ivatar.git
synced 2025-11-11 18:56:23 +00:00
Merge branch 'devel' into 'master'
Pull in latest developments See merge request oliver/ivatar!230
This commit is contained in:
@@ -1,5 +1,5 @@
|
|||||||
image:
|
image:
|
||||||
name: quay.io/rhn_support_ofalk/fedora35-python3
|
name: quay.io/rhn_support_ofalk/fedora36-python3
|
||||||
entrypoint:
|
entrypoint:
|
||||||
- "/bin/sh"
|
- "/bin/sh"
|
||||||
- "-c"
|
- "-c"
|
||||||
@@ -66,28 +66,28 @@ pages:
|
|||||||
expire_in: 14 days
|
expire_in: 14 days
|
||||||
only:
|
only:
|
||||||
- master
|
- master
|
||||||
build-image:
|
#build-image:
|
||||||
image: docker
|
# image: docker
|
||||||
only:
|
# only:
|
||||||
- master
|
# - master
|
||||||
- devel
|
# - devel
|
||||||
services:
|
# services:
|
||||||
- docker:dind
|
# - docker:dind
|
||||||
before_script:
|
# before_script:
|
||||||
- docker info
|
# - docker info
|
||||||
- docker login -u "$CI_REGISTRY_USER" -p "$CI_REGISTRY_PASSWORD" $CI_REGISTRY
|
# - docker login -u "$CI_REGISTRY_USER" -p "$CI_REGISTRY_PASSWORD" $CI_REGISTRY
|
||||||
script:
|
# script:
|
||||||
- ls -lah
|
# - ls -lah
|
||||||
- |
|
# - |
|
||||||
if [[ "$CI_COMMIT_BRANCH" == "$CI_DEFAULT_BRANCH" ]]; then
|
# if [[ "$CI_COMMIT_BRANCH" == "$CI_DEFAULT_BRANCH" ]]; then
|
||||||
tag=""
|
# tag=""
|
||||||
echo "Running on default branch '$CI_DEFAULT_BRANCH': tag = 'latest'"
|
# echo "Running on default branch '$CI_DEFAULT_BRANCH': tag = 'latest'"
|
||||||
else
|
# else
|
||||||
tag=":$CI_COMMIT_REF_SLUG"
|
# tag=":$CI_COMMIT_REF_SLUG"
|
||||||
echo "Running on branch '$CI_COMMIT_BRANCH': tag = $tag"
|
# echo "Running on branch '$CI_COMMIT_BRANCH': tag = $tag"
|
||||||
fi
|
# fi
|
||||||
- docker build --pull -t "$CI_REGISTRY_IMAGE${tag}" .
|
# - docker build --pull -t "$CI_REGISTRY_IMAGE${tag}" .
|
||||||
- docker push "$CI_REGISTRY_IMAGE${tag}"
|
# - docker push "$CI_REGISTRY_IMAGE${tag}"
|
||||||
semgrep:
|
semgrep:
|
||||||
stage: test
|
stage: test
|
||||||
allow_failure: true
|
allow_failure: true
|
||||||
|
|||||||
@@ -266,7 +266,7 @@ class Photo(BaseAccountModel):
|
|||||||
cropped_w, cropped_h = cropped.size
|
cropped_w, cropped_h = cropped.size
|
||||||
max_w = AVATAR_MAX_SIZE
|
max_w = AVATAR_MAX_SIZE
|
||||||
if cropped_w > max_w or cropped_h > max_w:
|
if cropped_w > max_w or cropped_h > max_w:
|
||||||
cropped = cropped.resize((max_w, max_w), Image.ANTIALIAS)
|
cropped = cropped.resize((max_w, max_w), Image.LANCZOS)
|
||||||
|
|
||||||
data = BytesIO()
|
data = BytesIO()
|
||||||
cropped.save(data, pil_format(self.format), quality=JPEG_QUALITY)
|
cropped.save(data, pil_format(self.format), quality=JPEG_QUALITY)
|
||||||
|
|||||||
@@ -256,7 +256,7 @@ class AvatarImageView(TemplateView):
|
|||||||
identicon = Identicon.render(kwargs["digest"])
|
identicon = Identicon.render(kwargs["digest"])
|
||||||
data = BytesIO()
|
data = BytesIO()
|
||||||
img = Image.open(BytesIO(identicon))
|
img = Image.open(BytesIO(identicon))
|
||||||
img = img.resize((size, size), Image.ANTIALIAS)
|
img = img.resize((size, size), Image.LANCZOS)
|
||||||
img.save(data, "PNG", quality=JPEG_QUALITY)
|
img.save(data, "PNG", quality=JPEG_QUALITY)
|
||||||
data.seek(0)
|
data.seek(0)
|
||||||
response = CachingHttpResponse(uri, data, content_type="image/png")
|
response = CachingHttpResponse(uri, data, content_type="image/png")
|
||||||
@@ -266,7 +266,7 @@ class AvatarImageView(TemplateView):
|
|||||||
if str(default) == "pagan":
|
if str(default) == "pagan":
|
||||||
paganobj = pagan.Avatar(kwargs["digest"])
|
paganobj = pagan.Avatar(kwargs["digest"])
|
||||||
data = BytesIO()
|
data = BytesIO()
|
||||||
img = paganobj.img.resize((size, size), Image.ANTIALIAS)
|
img = paganobj.img.resize((size, size), Image.LANCZOS)
|
||||||
img.save(data, "PNG", quality=JPEG_QUALITY)
|
img.save(data, "PNG", quality=JPEG_QUALITY)
|
||||||
data.seek(0)
|
data.seek(0)
|
||||||
response = CachingHttpResponse(uri, data, content_type="image/png")
|
response = CachingHttpResponse(uri, data, content_type="image/png")
|
||||||
@@ -331,9 +331,9 @@ class AvatarImageView(TemplateView):
|
|||||||
# If the image is smaller than what was requested, we need
|
# If the image is smaller than what was requested, we need
|
||||||
# to use the function resize
|
# to use the function resize
|
||||||
if photodata.size[0] < size or photodata.size[1] < size:
|
if photodata.size[0] < size or photodata.size[1] < size:
|
||||||
photodata = photodata.resize((size, size), Image.ANTIALIAS)
|
photodata = photodata.resize((size, size), Image.LANCZOS)
|
||||||
else:
|
else:
|
||||||
photodata.thumbnail((size, size), Image.ANTIALIAS)
|
photodata.thumbnail((size, size), Image.LANCZOS)
|
||||||
photodata.save(data, pil_format(imgformat), quality=JPEG_QUALITY)
|
photodata.save(data, pil_format(imgformat), quality=JPEG_QUALITY)
|
||||||
|
|
||||||
data.seek(0)
|
data.seek(0)
|
||||||
|
|||||||
Reference in New Issue
Block a user