2023-04-11 07:04:39 +08:00
2023-04-11 07:04:39 +08:00
2023-04-10 17:10:33 +08:00
2023-04-08 16:22:51 +08:00
mod
2023-04-08 13:32:05 +08:00
mod
2023-04-08 13:32:05 +08:00
2023-04-08 17:21:40 +08:00

webp

提供webp生成服务

// GET /webp/{type}-{id}-{version}-{width}-{height}-{fit}.{format}
// @type: image avatar article article_attribute ad
// @id: int 图片ID或是文章ID或是广告ID
// @version: update_time 时间戳
// @width: 宽度 1x 2x 3x 倍图直接输入尺寸
// @height: 高度 1x 2x 3x 倍图直接输入尺寸
// @fit: 裁切方式 cover contain fill auto

// GET /img/{type}-{id}.{format}?width=320&height=320&fit=cover
// 更优雅的实现, 使用查询参数的接口 (不幸的是CDN与OSS都不支持)

Update

# 静态编译
go build bin/main.go

# 上传到服务器
scp ./main root@47.103.40.152:~/main

Dev & Install

# 需要安装依赖
sudo apt install libopencv-dev

防止错误 ArucoDetector in namespace cv::aruco does not name a type 將安裝的 opencv 版本從 4.2 更改為 4.7,它工作正常。

# E: 无法定位软件包 libdc1394-22-dev
sudo add-apt-repository "deb http://security.ubuntu.com/ubuntu xenial-security main"
sudo apt update
sudo apt upgrade
sudo apt install libjasper1 libjasper-dev

# 添加主服务器
sudo gedit /etc/apt/sources.list
    deb http://archive.ubuntu.com/ubuntu/ trusty main universe restricted multiverse

sudo apt-get update
sudo apt update
sudo apt upgrade

# GPT 方案
sudo add-apt-repository universe
sudo apt update
sudo apt install libdc1394-22-dev
apt search libdc1394

# 手动下载 https://pkgs.org/download/libdc1394-22
wget http://archive.ubuntu.com/ubuntu/pool/universe/libd/libdc1394-22/libdc1394-22_2.2.5-2.1_amd64.deb
sudo dpkg -i libdc1394-22_2.2.5-2.1_amd64.deb
apt search libdc1394

# 确认安装后注释 Markfile 第52行
cd gocv
make install

# 下载超时请爬墙

torch 模型文件 https://d2j0dndfm35trm.cloudfront.net/resnet-50.t7 https://github.com/facebookarchive/fb.resnet.torch/tree/master/pretrained

Description
提供webp生成服务
Readme 7.1 MiB
test Latest
2024-11-04 10:32:37 +08:00
Languages
Go 96.7%
Python 2.2%
Makefile 1.1%