更新数据目录配置

This commit is contained in:
2026-03-21 22:13:31 +08:00
parent 78c3644b2c
commit d09a0487ae
6 changed files with 58 additions and 8 deletions

View File

@@ -4,8 +4,9 @@ import 'package:path/path.dart';
class Vips {
String? vipsExecuteFile;
final String cacheDir;
Vips({this.vipsExecuteFile});
Vips({this.vipsExecuteFile, required this.cacheDir});
/// 生成图片预览WebP 格式)
///
@@ -22,7 +23,7 @@ class Vips {
// 生成缓存文件名:包含原图 hash 和尺寸信息
final baseName = basename(imgPath).hashCode.toString();
final sizeSuffix = _buildSizeSuffix(w, h);
final imgOut = "cache/preview/${baseName}${sizeSuffix}.webp";
final imgOut = "$cacheDir/preview/$baseName$sizeSuffix.webp";
final outFile = File(imgOut);
// 缓存命中:直接返回已存在的预览图