From f7a2f1440ef0c13a472b1b815186615d2c54168a Mon Sep 17 00:00:00 2001 From: Vitaly Takmazov Date: Wed, 11 Apr 2018 14:05:43 +0300 Subject: server: ImagesService refactoring --- juick-common/src/main/java/com/juick/server/CommandsManager.java | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'juick-common/src/main/java/com/juick/server/CommandsManager.java') diff --git a/juick-common/src/main/java/com/juick/server/CommandsManager.java b/juick-common/src/main/java/com/juick/server/CommandsManager.java index 8dbe99e3..d924ac70 100644 --- a/juick-common/src/main/java/com/juick/server/CommandsManager.java +++ b/juick-common/src/main/java/com/juick/server/CommandsManager.java @@ -74,6 +74,8 @@ public class CommandsManager { private String imgDir; @Inject private ApplicationEventPublisher applicationEventPublisher; + @Inject + private ImagesService imagesService; public CommandResult processCommand(User user, String input, @Nonnull URI attachment) throws Exception { Optional cmd = MethodUtils.getMethodsListWithAnnotation(getClass(), UserCommand.class).stream() @@ -105,7 +107,7 @@ public class CommandsManager { String attachmentFName = attachment.getScheme().equals("juick") ? attachment.getHost() : HttpUtils.downloadImage(attachment.toURL(), tmpDir).getHost(); String fname = String.format("%d.%s", mid, attachmentType); - ImageUtils.saveImageWithPreviews(attachmentFName, fname, tmpDir, imgDir); + imagesService.saveImageWithPreviews(attachmentFName, fname); } com.juick.Message msg = messagesService.getMessage(mid); applicationEventPublisher.publishEvent(new MessageEvent(this, msg)); @@ -480,7 +482,7 @@ public class CommandsManager { String attachmentFName = attachment.getScheme().equals("juick") ? attachment.getHost() : HttpUtils.downloadImage(attachment.toURL(), tmpDir).getHost(); String fname = String.format("%d-%d.%s", mid, newrid, attachmentType); - ImageUtils.saveImageWithPreviews(attachmentFName, fname, tmpDir, imgDir); + imagesService.saveImageWithPreviews(attachmentFName, fname); } Message reply = messagesService.getReply(mid, newrid); applicationEventPublisher.publishEvent(new MessageEvent(this, reply)); -- cgit v1.2.3