Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Menu
Open sidebar
funkwhale
funkwhale
Commits
712f471f
Commit
712f471f
authored
Aug 28, 2020
by
Agate
💬
Browse files
Fix
#1205
: Added a new, large thumbnail size for cover images
parent
b1ae13ab
Pipeline
#12030
passed with stages
in 5 minutes and 9 seconds
Changes
7
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
api/config/settings/common.py
View file @
712f471f
...
...
@@ -1223,6 +1223,7 @@ VERSATILEIMAGEFIELD_RENDITION_KEY_SETS = {
"attachment_square"
:
[
(
"original"
,
"url"
),
(
"medium_square_crop"
,
"crop__200x200"
),
(
"large_square_crop"
,
"crop__600x600"
),
],
}
VERSATILEIMAGEFIELD_SETTINGS
=
{
...
...
api/funkwhale_api/common/models.py
View file @
712f471f
...
...
@@ -267,6 +267,13 @@ class Attachment(models.Model):
proxy_url
=
reverse
(
"api:v1:attachments-proxy"
,
kwargs
=
{
"uuid"
:
self
.
uuid
})
return
federation_utils
.
full_url
(
proxy_url
+
"?next=medium_square_crop"
)
@
property
def
download_url_large_square_crop
(
self
):
if
self
.
file
:
return
utils
.
media_url
(
self
.
file
.
crop
[
"600x600"
].
url
)
proxy_url
=
reverse
(
"api:v1:attachments-proxy"
,
kwargs
=
{
"uuid"
:
self
.
uuid
})
return
federation_utils
.
full_url
(
proxy_url
+
"?next=large_square_crop"
)
class
MutationAttachment
(
models
.
Model
):
"""
...
...
api/funkwhale_api/common/serializers.py
View file @
712f471f
...
...
@@ -297,6 +297,7 @@ class AttachmentSerializer(serializers.Serializer):
urls
[
"source"
]
=
o
.
url
urls
[
"original"
]
=
o
.
download_url_original
urls
[
"medium_square_crop"
]
=
o
.
download_url_medium_square_crop
urls
[
"large_square_crop"
]
=
o
.
download_url_large_square_crop
return
urls
def
create
(
self
,
validated_data
):
...
...
api/funkwhale_api/common/views.py
View file @
712f471f
...
...
@@ -175,7 +175,7 @@ class AttachmentViewSet(
return
r
size
=
request
.
GET
.
get
(
"next"
,
"original"
).
lower
()
if
size
not
in
[
"original"
,
"medium_square_crop"
]:
if
size
not
in
[
"original"
,
"medium_square_crop"
,
"large_square_crop"
]:
size
=
"original"
try
:
...
...
api/tests/common/test_serializers.py
View file @
712f471f
...
...
@@ -200,6 +200,9 @@ def test_attachment_serializer_existing_file(factories, to_api_date):
"medium_square_crop"
:
federation_utils
.
full_url
(
attachment
.
file
.
crop
[
"200x200"
].
url
),
"large_square_crop"
:
federation_utils
.
full_url
(
attachment
.
file
.
crop
[
"600x600"
].
url
),
},
}
...
...
@@ -227,6 +230,9 @@ def test_attachment_serializer_remote_file(factories, to_api_date):
"medium_square_crop"
:
federation_utils
.
full_url
(
proxy_url
+
"?next=medium_square_crop"
),
"large_square_crop"
:
federation_utils
.
full_url
(
proxy_url
+
"?next=large_square_crop"
),
},
}
...
...
changes/changelog.d/1205.enhancement
0 → 100644
View file @
712f471f
Added a new, large thumbnail size for cover images (#1205
\ No newline at end of file
front/src/components/Queue.vue
View file @
712f471f
...
...
@@ -6,8 +6,8 @@
<div
class=
"ui six wide column current-track"
>
<div
class=
"ui basic segment"
id=
"player"
>
<template
v-if=
"currentTrack"
>
<img
ref=
"cover"
alt=
""
v-if=
"currentTrack.cover && currentTrack.cover.urls.
original
"
:src=
"$store.getters['instance/absoluteUrl'](currentTrack.cover.urls.
original
)"
>
<img
ref=
"cover"
alt=
""
v-else-if=
"currentTrack.album && currentTrack.album.cover && currentTrack.album.cover.urls.
original
"
:src=
"$store.getters['instance/absoluteUrl'](currentTrack.album.cover.urls.
original
)"
>
<img
ref=
"cover"
alt=
""
v-if=
"currentTrack.cover && currentTrack.cover.urls.
large_square_crop
"
:src=
"$store.getters['instance/absoluteUrl'](currentTrack.cover.urls.
large_square_crop
)"
>
<img
ref=
"cover"
alt=
""
v-else-if=
"currentTrack.album && currentTrack.album.cover && currentTrack.album.cover.urls.
large_square_crop
"
:src=
"$store.getters['instance/absoluteUrl'](currentTrack.album.cover.urls.
large_square_crop
)"
>
<img
class=
"ui image"
alt=
""
v-else
src=
"../assets/audio/default-cover.png"
>
<h1
class=
"ui header"
>
<div
class=
"content ellipsis"
>
...
...
Write
Preview
Supports
Markdown
0%
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!
Cancel
Please
register
or
sign in
to comment