Skip to content

Commit

Permalink
render gifs, round the corners of media
Browse files Browse the repository at this point in the history
  • Loading branch information
mauforonda committed Dec 17, 2022
1 parent cfc9f41 commit 82aeddf
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 4 deletions.
5 changes: 3 additions & 2 deletions formatters.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,9 @@ def format_post(post, mastodon_base_url) -> dict:

def format_media(media):
formats = {
'image': f'<img src={media["url"]} alt={media["description"] if media["description"] != None else ""}></img>',
'video': f'<video src={media["url"]} controls width="100%"></video>'
'image': f'<div class="media"><img src={media["url"]} alt={media["description"] if media["description"] != None else ""}></img></div>',
'video': f'<div class="media"><video src={media["url"]} controls width="100%"></video></div>',
'gifv': f'<div class="media"><video src={media["url"]} autoplay loop muted playsinline width="100%"></video></div>'
}
if formats.__contains__(media.type):
return formats[media.type]
Expand Down
5 changes: 4 additions & 1 deletion render/style.css
Original file line number Diff line number Diff line change
Expand Up @@ -106,8 +106,10 @@ body {
word-break: break-word;
}

.media {
.medias {
padding-bottom: 15px;
display: flex;
gap: 5px;
}

.content p {
Expand Down Expand Up @@ -145,6 +147,7 @@ body {
.media img, .media video {
max-width: 100%;
max-height: 300px;
border-radius: 5px;
}

.footer {
Expand Down
2 changes: 1 addition & 1 deletion templates/posts.html.jinja
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
{{ post['content'] }}
</div>
{% if post['media'] %}
<div class="media">
<div class="medias">
{{ post['media'] }}
</div>
{% endif %}
Expand Down

0 comments on commit 82aeddf

Please sign in to comment.