GoPhotoGallery

command module
v0.0.0-...-4be548f Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 15, 2019 License: MIT Imports: 1 Imported by: 0

README

GoPhotoGallery

使用go重构图片浏览器,通过扫描指定文件夹来查询图片返回展示

使用Dep作为依赖管理

##配置

修改config.Config配置文件,配置图片所在文件夹

var Config = config{
	// 监听端口号
	Port: 8080,
	PostAssetRootUrl: "/post/",
	// 本地文章图文 绝对路径
	ScanPostPath:  "/Users/galaio/Downloads/test",
	RandPostCount: 5,
	StaticAssetRootUrl: "/static/",
	// html的静态文件路径
	StaticAssetPath: "/Users/galaio/Downloads/test",
}

参照文件目录如下:

/test 配置文件指明读取目录
├── user1
│   ├── post1
│   │   ├── 105537lbjcc46jvybjbqit.jpg
│   │   ├── 105613bw2k2mnl725tn3i5.jpg
│   │   └── tt.txt
│   └── post2
│       ├── 105537lbjcc46jvybjbqit.jpg
│       ├── 105613bw2k2mnl725tn3i5.jpg
│       └── tt.txt
└── user2
    ├── post3
    │   ├── 105537lbjcc46jvybjbqit.jpg
    │   ├── 105613bw2k2mnl725tn3i5.jpg
    │   └── tt.txt
    └── post4
        ├── 105537lbjcc46jvybjbqit.jpg
        ├── 105613bw2k2mnl725tn3i5.jpg
        └── tt.txt

启动

go run server.go

使用ngnix加速图片访问

按照说明修改nginx-gogallery.conf文件 随后安装nginx;

apt install nginx

复制配置文件;

cp nginx-gogallery.conf /etc/nginx/conf.d/

重启ngnix即可;

/etc/init.d/nginx reload

配置里增加二级域名的映射,需要在DNS解析配置 * 匹配规则

Documentation

The Go Gopher

There is no documentation for this package.

Directories

Path Synopsis
app

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL