Add file info at top of post images

This commit is contained in:
Dominic Ferrando
2025-04-21 00:57:35 -04:00
parent 65a3c155ce
commit 4e4b5614e0
4 changed files with 79 additions and 3 deletions
+1 -1
View File
@@ -75,7 +75,7 @@ templ Board(board database.Board) {
<option selected value="small">Small</option>
<option value="large">Large</option>
</select>
<input oninput="applyCatalogSearch()" id="catalogSearch" style="float: right;" placeholder="Search"/>
<input style="margin-left: 10px;" oninput="applyCatalogSearch()" id="catalogSearch" placeholder="Search"/>
</div>
<hr/>
<div
+11 -1
View File
@@ -9,16 +9,21 @@ import (
)
templ PostOriginal(post database.Post, thread *database.Thread) {
{{ imgInfo := util.GetPostImageInfo(post.MediaPath) }}
<article id={ fmt.Sprintf("post-%d", post.Id) } class="post-op">
<div>
File:
<a href={ templ.URL("/static/img/posts/full/" + post.MediaPath) } class="post-filename">
{ post.MediaPath }
</a>
<div class="post-img-info">
(<span>{ util.FormatBytes(imgInfo.Size) }</span>,
<span>{ strconv.Itoa(imgInfo.Width) }</span>x<span>{ strconv.Itoa(imgInfo.Height) }</span>)
</div>
</div>
<img onclick="togglePostImage(this)" loading="lazy" src={ fmt.Sprintf("/static/img/posts/thumb/%s", post.MediaPath)
} class="post-img" />
<header class="post-header">
<header style="margin-top: 10px;" class="post-header">
<h1 class="thread-subject">{ thread.Subject } -</h1>
<span class="post-author">{ post.Author }</span>
<span class="post-date">{ post.CreatedAt.Format("01/02/2006") }</span>
@@ -36,6 +41,7 @@ templ PostOriginal(post database.Post, thread *database.Thread) {
}
templ PostReply(post database.Post) {
{{ imgInfo := util.GetPostImageInfo(post.MediaPath) }}
<article id={ fmt.Sprintf("post-%d", post.Id) } class="post">
<header class="post-header">
<span class="post-author">{ post.Author }</span>
@@ -54,6 +60,10 @@ templ PostReply(post database.Post) {
<a href={ templ.URL("/static/img/posts/full/" + post.MediaPath) } class="post-filename">
{ post.MediaPath }
</a>
<div class="post-img-info">
(<span>{ util.FormatBytes(imgInfo.Size) }</span>,
<span>{ strconv.Itoa(imgInfo.Width) }</span>x<span>{ strconv.Itoa(imgInfo.Height) }</span>)
</div>
</div>
<img onclick="togglePostImage(this)" loading="lazy" src={ fmt.Sprintf("/static/img/posts/thumb/%s",
post.MediaPath) } class="post-img" />