Improve image loading by keeping size

rust
Elnu 2 years ago
parent 3b646c33df
commit 769fef28b6

@ -2,10 +2,10 @@
<figure> <figure>
{{ if .image }} {{ if .image }}
{{ $thumbnail := .image.Resize "500x" }} {{ $thumbnail := .image.Resize "500x" }}
<a href="{{ .image.RelPermalink }}" target="_blank"><img src="{{ $thumbnail.RelPermalink }}" alt="{{ .submission.username }}'s submission"></a> <a href="{{ .image.RelPermalink }}" target="_blank"><img src="{{ $thumbnail.RelPermalink }}" style="aspect-ratio: {{ .image.Width }} / {{ .image.Height }}" title="{{ .submission.username }}'s submission"></a>
<figcaption><a href="https://discord.com/users/{{ .submission.id }}"><i class="fab fa-discord"></i> {{ .submission.username }}</a></figcaption> <figcaption><a href="https://discord.com/users/{{ .submission.id }}"><i class="fab fa-discord"></i> {{ .submission.username }}</a></figcaption>
{{ else }} {{ else }}
<figcaption>Image not found!</figcaption> <figcaption>Image not found!</figcaption>
{{ end }} {{ end }}
</figure> </figure>
</div> </div>

@ -497,6 +497,8 @@ figure {
margin-bottom: var(--gap); margin-bottom: var(--gap);
overflow: hidden; overflow: hidden;
display: inline-block; display: inline-block;
width: 100%;
box-sizing: border-box;
} }
figcaption { figcaption {

Loading…
Cancel
Save