Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
synapse
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Terraform modules
Monitor
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Timo Ley
synapse
Commits
6aa88ed8
Commit
6aa88ed8
authored
2 years ago
by
Tulir Asokan
Browse files
Options
Downloads
Patches
Plain Diff
Thumbnail webp images as webp to avoid losing transparency
parent
85eea3de
No related branches found
No related tags found
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
synapse/config/repository.py
+6
-4
6 additions, 4 deletions
synapse/config/repository.py
synapse/media/thumbnailer.py
+1
-1
1 addition, 1 deletion
synapse/media/thumbnailer.py
with
7 additions
and
5 deletions
synapse/config/repository.py
+
6
−
4
View file @
6aa88ed8
...
...
@@ -47,10 +47,8 @@ THUMBNAIL_SIZE_YAML = """\
THUMBNAIL_SUPPORTED_MEDIA_FORMAT_MAP
=
{
"
image/jpeg
"
:
"
jpeg
"
,
"
image/jpg
"
:
"
jpeg
"
,
"
image/webp
"
:
"
jpeg
"
,
# Thumbnails can only be jpeg or png. We choose png thumbnails for gif
# because it can have transparency.
"
image/gif
"
:
"
png
"
,
"
image/webp
"
:
"
webp
"
,
"
image/gif
"
:
"
webp
"
,
"
image/png
"
:
"
png
"
,
}
...
...
@@ -102,6 +100,10 @@ def parse_thumbnail_requirements(
requirement
.
append
(
ThumbnailRequirement
(
width
,
height
,
method
,
"
image/png
"
)
)
elif
thumbnail_format
==
"
webp
"
:
requirement
.
append
(
ThumbnailRequirement
(
width
,
height
,
method
,
"
image/webp
"
)
)
else
:
raise
Exception
(
"
Unknown thumbnail mapping from %s to %s. This is a Synapse problem, please report!
"
...
...
This diff is collapsed.
Click to expand it.
synapse/media/thumbnailer.py
+
1
−
1
View file @
6aa88ed8
...
...
@@ -38,7 +38,7 @@ class ThumbnailError(Exception):
class
Thumbnailer
:
FORMATS
=
{
"
image/jpeg
"
:
"
JPEG
"
,
"
image/png
"
:
"
PNG
"
}
FORMATS
=
{
"
image/jpeg
"
:
"
JPEG
"
,
"
image/png
"
:
"
PNG
"
,
"
image/webp
"
:
"
WEBP
"
}
@staticmethod
def
set_limits
(
max_image_pixels
:
int
)
->
None
:
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment