You've already forked FrameTour-BE
fix(printer): 修复打印照片方向检测逻辑
- 修改图片方向判断方式,从文件检测改为读取crop配置中的rotation值 - 添加异常处理机制,确保旋转角度解析失败时能正确抛出异常 - 保持竖图自动旋转为横图的处理逻辑不变
This commit is contained in:
@@ -792,8 +792,14 @@ public class PrinterServiceImpl implements PrinterService {
|
||||
HttpUtil.downloadFile(item.getCropUrl().replace("oss.zhentuai.com", "frametour-assets.oss-cn-shanghai-internal.aliyuncs.com"), originalFile);
|
||||
|
||||
// 判断图片方向并处理旋转
|
||||
boolean isLandscape = ImageUtils.isLandscape(originalFile);
|
||||
log.info("打印照片方向检测,照片ID: {}, 是否为横图: {}", item.getId(), isLandscape);
|
||||
boolean isLandscape = false;
|
||||
try {
|
||||
Integer rotate = JacksonUtil.getInt(item.getCrop(), "rotation");
|
||||
if (rotate != null) {
|
||||
isLandscape = rotate % 180 != 0;
|
||||
}
|
||||
} catch (Exception ignored) {
|
||||
}
|
||||
|
||||
if (!isLandscape) {
|
||||
// 竖图需要旋转为横图
|
||||
|
||||
Reference in New Issue
Block a user