Images are now centered, both vertically and horizontally

This commit is contained in:
Seednode 2022-11-10 23:24:14 -06:00
parent 0bdbc5d2a0
commit 0b34784b12
2 changed files with 5 additions and 3 deletions

View File

@ -10,7 +10,7 @@ import (
"github.com/spf13/cobra"
)
var Version = "0.25.5"
var Version = "0.26.0"
func init() {
rootCmd.AddCommand(versionCmd)

View File

@ -220,8 +220,10 @@ func serveHtml(w http.ResponseWriter, r *http.Request, filePath string, dimensio
var htmlBody strings.Builder
htmlBody.WriteString(`<!DOCTYPE html><html lang="en"><head>`)
htmlBody.WriteString(`<style>a{display:block;height:100%;width:100%;text-decoration:none;}`)
htmlBody.WriteString(`img{max-width:100%;max-height:97vh;object-fit:contain;}</style>`)
htmlBody.WriteString(`<style>html,body{margin:0;padding:0;height:100%;}`)
htmlBody.WriteString(`a{display:block;height:100%;width:100%;text-decoration:none;}`)
htmlBody.WriteString(`img{margin:auto;display:block;max-width:97%;max-height:97%;object-fit:scale-down;`)
htmlBody.WriteString(`position:absolute;top:50%;left:50%;transform:translate(-50%,-50%);}</style>`)
htmlBody.WriteString(fmt.Sprintf(`<title>%v (%vx%v)</title>`,
fileName,
dimensions.Width,