aboutsummaryrefslogtreecommitdiff
path: root/juick-common/src/main/java/com/juick/server/CommandsManager.java
diff options
context:
space:
mode:
Diffstat (limited to 'juick-common/src/main/java/com/juick/server/CommandsManager.java')
-rw-r--r--juick-common/src/main/java/com/juick/server/CommandsManager.java6
1 files changed, 4 insertions, 2 deletions
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<Method> 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));