1 Star 0 Fork 0

Green / simple_go_img_server

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
bito_templates.go 1.53 KB
一键复制 编辑 原始数据 按行查看 历史
Green 提交于 2019-12-15 22:21 . init
package main
const (
//=========================================================
RootTemplate = `<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Image server</title>
</head>
<body>
<h2> 静态文件服务器: <a href="/files">{{.}}/files</a> </h2>
<h2> 图片列表: <a href="/list">{{.}}/list</a> </h2>
</body>
</html>
`
//=========================================================
ImgListTemplate = `<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Image server</title>
<style>
.img-item{
display:inline-block;
max-width:400px;
max-height:400px;
}
.img-item-img{
display:inline-block;
max-width:100%;
max-height:80%;
font-size:18px;
}
.img-item-name{
display:inline-block;
max-width:100%;
max-height:20%;
font-size:18px;
}
</style>
</head>
<body>
<h1>当前目录 ${ROOT_DIR}{{.CurDir}}<h2>
<div>
<h2>子目录目录</h2>
<ul class="dir-list">
{{range .DirItems}}
<li class="dir-item">
<a href="{{.URL}}">{{.Name}}</a>
</li>
{{end}}
</ul>
</div>
<div>
<h2>其余文件</h2>
<ul class="other-list">
{{range .OtherItems}}
<li class="other-item">
<a href="{{.URL}}">{{.Name}}</a>
</li>
{{end}}
</ul>
</div>
<div>
<h2>当前目录图片</h2>
<ul class="img-list">
{{range .ImgItems}}
<li class="img-item">
<a href="{{.URL}}">
<img class="img-item-img" src="{{.URL}}" alt="{{.Name}}"></img>
<p class="img-item-name">{{.Name}}</p>
</a>
</li>
{{end}}
</ul>
</div>
</body>
</html>
`
)
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/bitosky/simple_go_img_server.git
git@gitee.com:bitosky/simple_go_img_server.git
bitosky
simple_go_img_server
simple_go_img_server
master

搜索帮助

344bd9b3 5694891 D2dac590 5694891