Skip to content

Commit 632cc16

Browse files
committed
2.0.1
1 parent 917a098 commit 632cc16

File tree

3 files changed

+13
-14
lines changed

3 files changed

+13
-14
lines changed

src/main/java/io/nbs/client/helper/AvatarImageHandler.java

Lines changed: 11 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -43,13 +43,13 @@ public static AvatarImageHandler getInstance() {
4343
/**
4444
* 联系人头像 32 *32
4545
* 40*40
46-
* .nbs/cache/avatars/thumbs
46+
* .nbs/cache/avatars/custom
4747
*/
48-
private static String AVATAR_THUMB_HOME;
48+
private static String AVATAR_CUSTOM_HOME;
4949
/**
50-
* 用户配置头标
50+
* 用户配置头标
5151
* .nbs/profile/avatars/
52-
* 放置128*128 上传IPFS
52+
* 放置128*128 上传IPFS
5353
* .nbs/profile/avatars/thumbs
5454
* 64*64 hashFileName
5555
*/
@@ -64,7 +64,7 @@ public static AvatarImageHandler getInstance() {
6464
private AvatarImageHandler() {
6565
AVATAR_PROFILE_HOME = AppGlobalCnst.consturactPath(Launcher.appBasePath,"profile","avatars");
6666
AVATAR_ORIGIN_HOME = AppGlobalCnst.consturactPath(Launcher.appBasePath,"profile","origin");
67-
AVATAR_THUMB_HOME = AppGlobalCnst.consturactPath(Launcher.appBasePath,"cache","avatars","thumbs");
67+
AVATAR_CUSTOM_HOME = AppGlobalCnst.consturactPath(Launcher.appBasePath,"cache","avatars","custom");
6868
}
6969

7070
/**
@@ -84,7 +84,7 @@ public void initAvatarLocalDir(){
8484
destFile = new File(AVATAR_ORIGIN_HOME);
8585
if(!destFile.exists())destFile.mkdirs();
8686

87-
destFile = new File(AVATAR_THUMB_HOME);
87+
destFile = new File(AVATAR_CUSTOM_HOME);
8888
if(!destFile.exists())destFile.mkdirs();
8989
}
9090

@@ -148,14 +148,14 @@ public void createdAvatar4Profile(File srcFile,String hashFileName) throws Excep
148148
}
149149

150150
/**
151-
* 40
151+
* 40*40png
152152
* @param srcFile
153153
* @param hashFileName
154154
* @return
155155
*/
156156
public ImageIcon createContactsAvatar(File srcFile,String hashFileName){
157157
if(srcFile==null||!srcFile.exists())return null;
158-
String targetPath = AppGlobalCnst.consturactPath(AVATAR_THUMB_HOME,hashFileName);
158+
String targetPath = AppGlobalCnst.consturactPath(AVATAR_CUSTOM_HOME,hashFileName);
159159
File thumbs4Contacts = new File(targetPath);
160160
try {
161161
generateThumbScale(srcFile,thumbs4Contacts,DEFAULT_CONTACTS_THUMB_SIZE);
@@ -222,10 +222,9 @@ private void compressImage(Image img,File destFile,int w,int h) throws IOExcepti
222222
/**
223223
* 联系人头像 32 *32
224224
* 40*40
225-
* .nbs/cache/avatars/thumbs
226-
*/
227-
public static String getAvatarThumbHome() {
228-
return AVATAR_THUMB_HOME;
225+
* .nbs/cache/avatars/custom
226+
public static String getAvatarCustomHome() {
227+
return AVATAR_CUSTOM_HOME;
229228
}
230229
231230
/**

src/main/java/io/nbs/client/ui/frames/InitialFrame.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -573,7 +573,7 @@ private boolean uploadAvatar(){
573573
tempInfo.setAvatar(fileHash);
574574
tempInfo.setAvatarSuffix(name.substring(name.lastIndexOf(".")));
575575
//TODO 存数据库upload
576-
String avatarFileName = fileHash+ name.substring(name.lastIndexOf("."));
576+
String avatarFileName = fileHash+".png";
577577
try {
578578
imageHandler.createContactsAvatar(file,avatarFileName);
579579
ImageIcon icon = new ImageIcon(AppGlobalCnst.consturactPath(AvatarImageHandler.getAvatarProfileHome(),name));

src/main/java/io/nbs/client/ui/panels/info/InfoHeaderPanel.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -229,7 +229,7 @@ private void uploadAvatar(){
229229
/**
230230
* 40*40
231231
*/
232-
String hashFileName = fileHash+ name.substring(name.lastIndexOf("."));
232+
String hashFileName = fileHash+".png";
233233
try {
234234
imageHandler.createContactsAvatar(file,hashFileName);
235235
Image img =Toolkit.getDefaultToolkit().getImage(AppGlobalCnst.consturactPath(AvatarImageHandler.getAvatarProfileHome(),name));

0 commit comments

Comments
 (0)