|
@@ -63,6 +63,7 @@ import javax.annotation.Resource;
|
|
|
import javax.imageio.ImageIO;
|
|
|
import java.awt.image.BufferedImage;
|
|
|
import java.io.*;
|
|
|
+import java.net.URL;
|
|
|
import java.nio.charset.StandardCharsets;
|
|
|
import java.text.MessageFormat;
|
|
|
import java.text.ParseException;
|
|
@@ -1033,33 +1034,33 @@ public class ImGroupServiceImpl extends ServiceImpl<ImGroupDao, ImGroup> impleme
|
|
|
//bais = new ByteArrayInputStream(bytes);
|
|
|
|
|
|
//获取图片类型
|
|
|
- String suffix = name.substring(name.lastIndexOf(".") + 1);
|
|
|
+ //String suffix = name.substring(name.lastIndexOf(".") + 1);
|
|
|
//获取JDK8里的解码器Base64.Decoder,将base64字符串转为字节数组
|
|
|
byte[] bytes = Base64.getDecoder().decode(content);
|
|
|
//构建字节数组输入流
|
|
|
bais = new ByteArrayInputStream(bytes);
|
|
|
- //通过ImageIO把字节数组输入流转为BufferedImage
|
|
|
+ /* //通过ImageIO把字节数组输入流转为BufferedImage
|
|
|
BufferedImage bufferedImage = ImageIO.read(bais);
|
|
|
|
|
|
//构建文件
|
|
|
File imageFile = new File(name);
|
|
|
//写入生成文件
|
|
|
- ImageIO.write(bufferedImage, suffix, imageFile);
|
|
|
+ ImageIO.write(bufferedImage, format, imageFile);*/
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
- UploadReturnBean uploadReturnBean = uploadFileService.uploadFile(bais, suffix);
|
|
|
+ UploadReturnBean uploadReturnBean = uploadFileService.uploadFile(bais, format);
|
|
|
String url = uploadReturnBean.getUrl();
|
|
|
- /*BufferedImage read = ImageIO.read(bais);
|
|
|
+ URL url2 = new URL(url);
|
|
|
+ BufferedImage read = ImageIO.read(url2);
|
|
|
int width = read.getWidth();
|
|
|
- int height = read.getHeight();*/
|
|
|
-
|
|
|
+ int height = read.getHeight();
|
|
|
|
|
|
ImageUtil.ImageInfo imageReq = ImageUtil.ImageInfo.builder()
|
|
|
.imgUrl(url)
|
|
|
- .suffix(suffix)
|
|
|
+ .suffix(format)
|
|
|
.build();
|
|
|
|
|
|
|
|
@@ -1072,9 +1073,9 @@ public class ImGroupServiceImpl extends ServiceImpl<ImGroupDao, ImGroup> impleme
|
|
|
timVideoFileElem.setVideoDownloadFlag(2);
|
|
|
timVideoFileElem.setThumbUrl(url);
|
|
|
timVideoFileElem.setThumbUUID(imageReq.getMd5());
|
|
|
- timVideoFileElem.setThumbWidth( bufferedImage.getWidth());
|
|
|
- timVideoFileElem.setThumbHeight( bufferedImage.getHeight());
|
|
|
- timVideoFileElem.setThumbSize((imageReq.getSize().intValue()));
|
|
|
+ timVideoFileElem.setThumbWidth( width);
|
|
|
+ timVideoFileElem.setThumbHeight( height);
|
|
|
+ //timVideoFileElem.setThumbSize((imageReq.getSize().intValue()));
|
|
|
timVideoFileElem.setThumbDownloadFlag(2);
|
|
|
timVideoFileElem.setThumbFormat(format);
|
|
|
|