diff --git a/src/main/java/org/krews/apollyon/incoming/CameraRoomPictureEvent.java b/src/main/java/org/krews/apollyon/incoming/CameraRoomPictureEvent.java index 7f35ffd..7343b5c 100644 --- a/src/main/java/org/krews/apollyon/incoming/CameraRoomPictureEvent.java +++ b/src/main/java/org/krews/apollyon/incoming/CameraRoomPictureEvent.java @@ -55,13 +55,14 @@ public class CameraRoomPictureEvent extends MessageHandler this.client.getHabbo().getHabboInfo().setPhotoJSON(json); try { - BufferedImage theImage = ImageIO.read(new ByteBufInputStream(image)); if(Emulator.getConfig().getInt("ftp.enabled") == 1) { - byte[] imageBytes = ((DataBufferByte) theImage.getData().getDataBuffer()).getData(); + byte[] imageBytes = new byte[image.readableBytes()]; + image.readBytes(imageBytes); FTPUploadService.uploadImage(imageBytes, Emulator.getConfig().getValue("imager.location.output.camera") + URL); FTPUploadService.uploadImage(imageBytes, Emulator.getConfig().getValue("imager.location.output.camera") + URL_small); } else { + BufferedImage theImage = ImageIO.read(new ByteBufInputStream(image)); ImageIO.write(theImage, "png", new File(Emulator.getConfig().getValue("imager.location.output.camera") + URL)); ImageIO.write(theImage, "png", new File(Emulator.getConfig().getValue("imager.location.output.camera") + URL_small)); } diff --git a/src/main/java/org/krews/apollyon/incoming/CameraRoomThumbnailEvent.java b/src/main/java/org/krews/apollyon/incoming/CameraRoomThumbnailEvent.java index 5bcda85..924ec37 100644 --- a/src/main/java/org/krews/apollyon/incoming/CameraRoomThumbnailEvent.java +++ b/src/main/java/org/krews/apollyon/incoming/CameraRoomThumbnailEvent.java @@ -57,7 +57,8 @@ public class CameraRoomThumbnailEvent extends MessageHandler try { if(Emulator.getConfig().getInt("ftp.enabled") == 1) { - byte[] imageBytes = ((DataBufferByte) theImage.getData().getDataBuffer()).getData(); + byte[] imageBytes = new byte[image.readableBytes()]; + image.readBytes(imageBytes); FTPUploadService.uploadImage(imageBytes, Emulator.getConfig().getValue("imager.location.output.thumbnail") + room.getId() + ".png"); } else {