aggregate poster log

master
Yixian 3 years ago
parent 925909f05f
commit 0cf077e73c

@ -2705,13 +2705,22 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid
HttpRequestResult boardBackgroundResult = new HttpRequestGenerator( HttpRequestResult boardBackgroundResult = new HttpRequestGenerator(
url, RequestMethod.GET).execute(); url, RequestMethod.GET).execute();
if (boardBackgroundResult.isSuccess()) { if (boardBackgroundResult.isSuccess()) {
InputStream ins = boardBackgroundResult.getResponseContentStream(); try (ByteArrayOutputStream bos = new ByteArrayOutputStream()) {
BufferedImage background = ImageIO.read(ins); InputStream ins = boardBackgroundResult.getResponseContentStream();
logger.debug("aggregate image size {}x{}", background.getWidth(), background.getHeight()); BufferedImage background = ImageIO.read(ins);
IOUtils.closeQuietly(ins); IOUtils.closeQuietly(ins);
ImageIO.write(background, "jpeg", ous); logger.debug("aggregate image size {}x{}", background.getWidth(), background.getHeight());
ous.flush(); BufferedImage img = new BufferedImage(background.getWidth(), background.getHeight(), BufferedImage.TYPE_3BYTE_BGR);
IOUtils.closeQuietly(ous); Graphics g = img.getGraphics();
g.drawImage(background, 0, 0, null);
g.dispose();
ImageIO.write(img, "jpeg", bos);
bos.flush();
byte[] imageBytes = bos.toByteArray();
logger.debug("aggregate image length {}", imageBytes.length);
ous.write(imageBytes);
IOUtils.closeQuietly(ous);
}
} else { } else {
logger.error("get aggregate poster file failed:[{}]-{}", boardBackgroundResult.getStatusCode(), logger.error("get aggregate poster file failed:[{}]-{}", boardBackgroundResult.getStatusCode(),
boardBackgroundResult.getResponseContentString(), boardBackgroundResult.getException()); boardBackgroundResult.getResponseContentString(), boardBackgroundResult.getException());

Loading…
Cancel
Save