Push
This commit is contained in:
parent
7f0af8f392
commit
85cdb059d4
@ -27,6 +27,11 @@ public class Main {
|
|||||||
public static void main(String[] args) {
|
public static void main(String[] args) {
|
||||||
|
|
||||||
port(8080);
|
port(8080);
|
||||||
|
get("/heartbeat", (req, res) -> {
|
||||||
|
res.status(200);
|
||||||
|
res.type("application/json");
|
||||||
|
return "{ \"up\":true }";
|
||||||
|
});
|
||||||
post("/", (req, res) -> {
|
post("/", (req, res) -> {
|
||||||
res.type("image/png");
|
res.type("image/png");
|
||||||
JsonObject data = new Gson().fromJson(req.body(), JsonObject.class);
|
JsonObject data = new Gson().fromJson(req.body(), JsonObject.class);
|
||||||
@ -47,7 +52,7 @@ public class Main {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private static byte[] generate(String name, String title, String email, String location, String address, String schoolNumber, String extension, boolean hasExtension, String cellNumber, boolean hasCell) {
|
private static byte[] generate(String name, String title, String email, String location, String address, String schoolNumber, String extension, boolean hasExtension, String cellNumber, boolean hasCell) {
|
||||||
BufferedImage finalImage = new BufferedImage(1080, 602, BufferedImage.TYPE_INT_ARGB);
|
BufferedImage rawImage = new BufferedImage(1080, 602, BufferedImage.TYPE_INT_ARGB);
|
||||||
BufferedImage background;
|
BufferedImage background;
|
||||||
|
|
||||||
try {
|
try {
|
||||||
@ -57,7 +62,7 @@ public class Main {
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
Graphics2D g = finalImage.createGraphics();
|
Graphics2D g = rawImage.createGraphics();
|
||||||
g.setRenderingHint(RenderingHints.KEY_TEXT_ANTIALIASING, RenderingHints.VALUE_TEXT_ANTIALIAS_ON);
|
g.setRenderingHint(RenderingHints.KEY_TEXT_ANTIALIASING, RenderingHints.VALUE_TEXT_ANTIALIAS_ON);
|
||||||
|
|
||||||
g.drawImage(background, 0, 0, null);
|
g.drawImage(background, 0, 0, null);
|
||||||
@ -159,6 +164,14 @@ public class Main {
|
|||||||
|
|
||||||
g.dispose();
|
g.dispose();
|
||||||
|
|
||||||
|
BufferedImage finalImage = new BufferedImage(300, 167, BufferedImage.TYPE_INT_ARGB);
|
||||||
|
|
||||||
|
|
||||||
|
g = finalImage.createGraphics();
|
||||||
|
g.setRenderingHint(RenderingHints.KEY_INTERPOLATION, RenderingHints.VALUE_INTERPOLATION_BILINEAR);
|
||||||
|
g.drawImage(rawImage, 0, 0, 300, 167, null);
|
||||||
|
g.dispose();
|
||||||
|
|
||||||
ByteArrayOutputStream baos;
|
ByteArrayOutputStream baos;
|
||||||
try {
|
try {
|
||||||
baos = new ByteArrayOutputStream();
|
baos = new ByteArrayOutputStream();
|
||||||
|
Loading…
Reference in New Issue
Block a user