- 修复Dockerfile构建问题,暂时禁用ideal-image插件 - 更新所有配置文件中的registry端口为5003 - 添加.dockerignore文件优化构建性能 - 创建docker-compose.yml文件支持本地部署 - 添加部署脚本scripts/deploy-docker.sh - 更新Gitea Actions工作流,添加Docker部署步骤 - 创建DOCKER_DEPLOYMENT.md部署文档 - 支持通过3001端口提供lingjingwanxiang web portal服务
33 lines
832 B
JavaScript
33 lines
832 B
JavaScript
"use strict";
|
|
|
|
const jimp = require('jimp');
|
|
|
|
module.exports = imagePath => {
|
|
const readImage = jimp.read(imagePath);
|
|
return {
|
|
metadata: () => readImage.then(image => ({
|
|
width: image.bitmap.width,
|
|
height: image.bitmap.height
|
|
})),
|
|
resize: ({
|
|
width,
|
|
mime,
|
|
options
|
|
}) => new Promise((resolve, reject) => {
|
|
readImage.then(image => {
|
|
image.clone().resize(width, jimp.AUTO).quality(options.quality).background(parseInt(options.background, 16) || 0xFFFFFFFF).getBuffer(mime, function (err, data) {
|
|
// eslint-disable-line func-names
|
|
if (err) {
|
|
reject(err);
|
|
} else {
|
|
resolve({
|
|
data,
|
|
width,
|
|
height: this.bitmap.height
|
|
});
|
|
}
|
|
});
|
|
});
|
|
})
|
|
};
|
|
}; |