Commit 8b8b1fda authored by shiyu's avatar shiyu

媒体工具类

parent 27dfa48b
......@@ -209,6 +209,7 @@ public class QiniuStorage implements Storage {
*/
public String reStore(String imageUrl) {
try {
if (imageUrl.contains("_") && imageUrl.contains("x")) {
URL url = new URL(imageUrl);
InputStream inputStream = url.openStream();
BufferedImage bufferedImage = ImageIO.read(inputStream);
......@@ -216,9 +217,10 @@ public class QiniuStorage implements Storage {
InputStream imageStream = MediaUtil.bufferedImageToInputStream(bufferedImage, MediaTypeEnum.IMAGE_JPG.getExt());
store(imageStream, 1, MediaTypeEnum.IMAGE_JPG.getMime(), keyName);
return keyName;
}
} catch (Exception e) {
logger.error("获取图片尺寸重新上传图片出错 : {}", e);
}
return null;
return imageUrl;
}
}
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment