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(
url, RequestMethod.GET).execute();
if (boardBackgroundResult.isSuccess()) {
InputStream ins = boardBackgroundResult.getResponseContentStream();
BufferedImage background = ImageIO.read(ins);
logger.debug("aggregate image size {}x{}", background.getWidth(), background.getHeight());
IOUtils.closeQuietly(ins);
ImageIO.write(background, "jpeg", ous);
ous.flush();
IOUtils.closeQuietly(ous);
try (ByteArrayOutputStream bos = new ByteArrayOutputStream()) {
InputStream ins = boardBackgroundResult.getResponseContentStream();
BufferedImage background = ImageIO.read(ins);
IOUtils.closeQuietly(ins);
logger.debug("aggregate image size {}x{}", background.getWidth(), background.getHeight());
BufferedImage img = new BufferedImage(background.getWidth(), background.getHeight(), BufferedImage.TYPE_3BYTE_BGR);
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 {
logger.error("get aggregate poster file failed:[{}]-{}", boardBackgroundResult.getStatusCode(),
boardBackgroundResult.getResponseContentString(), boardBackgroundResult.getException());

Loading…
Cancel
Save