aboutsummaryrefslogtreecommitdiff
path: root/juick-www
diff options
context:
space:
mode:
authorGravatar Vitaly Takmazov2018-04-11 14:05:43 +0300
committerGravatar Vitaly Takmazov2018-04-11 14:05:43 +0300
commitf7a2f1440ef0c13a472b1b815186615d2c54168a (patch)
tree2270b2bd9948cdb809e40942b63cf4c84172a53a /juick-www
parent6f346454e906d07551c35a7173fd8175b4d0975d (diff)
server: ImagesService refactoring
Diffstat (limited to 'juick-www')
-rw-r--r--juick-www/src/main/java/com/juick/www/controllers/NewMessage.java4
-rw-r--r--juick-www/src/main/java/com/juick/www/controllers/Settings.java4
2 files changed, 6 insertions, 2 deletions
diff --git a/juick-www/src/main/java/com/juick/www/controllers/NewMessage.java b/juick-www/src/main/java/com/juick/www/controllers/NewMessage.java
index 07605830..042a1b0f 100644
--- a/juick-www/src/main/java/com/juick/www/controllers/NewMessage.java
+++ b/juick-www/src/main/java/com/juick/www/controllers/NewMessage.java
@@ -67,6 +67,8 @@ public class NewMessage {
private WebApp webApp;
@Inject
private ExternalComponent xmpp;
+ @Inject
+ private ImagesService imagesService;
@Value("${img_path:#{systemEnvironment['TEMP'] ?: '/tmp'}}")
private String imgDir;
@Value("${upload_tmp_dir:#{systemEnvironment['TEMP'] ?: '/tmp'}}")
@@ -167,7 +169,7 @@ public class NewMessage {
String fname = mid + "-" + ridnew + "." + attachmentType;
String attachmentURL = "http://i.juick.com/photos-1024/" + fname;
- ImageUtils.saveImageWithPreviews(attachmentFName.getHost(), fname, tmpDir, imgDir);
+ imagesService.saveImageWithPreviews(attachmentFName.getHost(), fname);
body = attachmentURL + "\n" + body;
try {
diff --git a/juick-www/src/main/java/com/juick/www/controllers/Settings.java b/juick-www/src/main/java/com/juick/www/controllers/Settings.java
index 15f18052..3d381815 100644
--- a/juick-www/src/main/java/com/juick/www/controllers/Settings.java
+++ b/juick-www/src/main/java/com/juick/www/controllers/Settings.java
@@ -76,6 +76,8 @@ public class Settings {
private TelegramService telegramService;
@Inject
private ApplicationEventPublisher applicationEventPublisher;
+ @Inject
+ private ImagesService imagesService;
@GetMapping("/settings")
protected String doGet(HttpServletRequest request, HttpServletResponse response, ModelMap model) throws IOException {
@@ -160,7 +162,7 @@ public class Settings {
info.setDescription(request.getParameter("descr"));
String avatarTmpPath = HttpUtils.receiveMultiPartFile(avatar, tmpDir).getHost();
if (StringUtils.isNotEmpty(avatarTmpPath)) {
- ImageUtils.saveAvatar(avatarTmpPath, visitor.getUid(), tmpDir, imgDir);
+ imagesService.saveAvatar(avatarTmpPath, visitor.getUid());
}
if (userService.updateUserInfo(visitor, info)) {
applicationEventPublisher.publishEvent(new UserUpdatedEvent(this, visitor));