master
Yixian 3 years ago
parent 37b1e38f02
commit 6350b5e4c7

@ -2709,6 +2709,9 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid
ImageIO.write(background, "jpeg", ous); ImageIO.write(background, "jpeg", ous);
ous.flush(); ous.flush();
IOUtils.closeQuietly(ous); IOUtils.closeQuietly(ous);
} else {
logger.error("get aggregate poster file failed:[{}]", boardBackgroundResult.getStatusCode(),
boardBackgroundResult.getResponseContentString(), boardBackgroundResult.getException());
} }
} catch (IOException e) { } catch (IOException e) {
throw new ServerErrorException("Error", e); throw new ServerErrorException("Error", e);
@ -4982,6 +4985,7 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid
/** /**
* aps * aps
*
* @param manager * @param manager
* @param clientMoniker * @param clientMoniker
* @param enableOverseaWallet * @param enableOverseaWallet

@ -0,0 +1,42 @@
package au.com.royalpay.payment.manage.valid;
import au.com.royalpay.payment.tools.env.PlatformEnvironment;
import au.com.royalpay.payment.tools.exceptions.ServerErrorException;
import cn.yixblog.platform.http.HttpRequestGenerator;
import cn.yixblog.platform.http.HttpRequestResult;
import com.alibaba.fastjson.JSONObject;
import org.apache.commons.io.IOUtils;
import org.junit.Test;
import org.springframework.web.bind.annotation.RequestMethod;
import javax.imageio.ImageIO;
import java.awt.image.BufferedImage;
import java.io.ByteArrayOutputStream;
import java.io.File;
import java.io.IOException;
import java.io.InputStream;
public class ImageTest {
@Test
public void test() throws IOException {
try (ByteArrayOutputStream ous = new ByteArrayOutputStream()){
HttpRequestResult boardBackgroundResult = new HttpRequestGenerator("https://au.rpaygroup.com/static/images/post.jpg",
RequestMethod.GET).execute();
if (boardBackgroundResult.isSuccess()) {
InputStream ins = boardBackgroundResult.getResponseContentStream();
BufferedImage background = ImageIO.read(ins);
IOUtils.closeQuietly(ins);
// Graphics g = background.getGraphics();
// drawPosterLogo(client, g);
// g.dispose();
ImageIO.write(background, "jpeg", ous);
ous.flush();
System.out.println(ous.toByteArray().length);
}
} catch (IOException e) {
throw new ServerErrorException("Error", e);
}
}
}
Loading…
Cancel
Save