mirror of
https://gitee.com/dromara/MaxKey.git
synced 2026-05-14 20:50:14 +08:00
image change to base 64
This commit is contained in:
@@ -19,6 +19,7 @@ package org.maxkey.entity;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonIgnore;
|
||||
import java.io.IOException;
|
||||
import java.util.Base64;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
|
||||
@@ -101,6 +102,7 @@ public class UserInfo extends JpaBaseEntity {
|
||||
@JsonIgnore
|
||||
@Column
|
||||
protected byte[] picture;
|
||||
protected String pictureBase64;
|
||||
@JsonIgnore
|
||||
protected MultipartFile pictureFile;
|
||||
@Column
|
||||
@@ -399,7 +401,22 @@ public class UserInfo extends JpaBaseEntity {
|
||||
return picture;
|
||||
}
|
||||
|
||||
/**
|
||||
public String getPictureBase64() {
|
||||
return pictureBase64;
|
||||
}
|
||||
|
||||
public void setPictureBase64(String pictureBase64) {
|
||||
this.pictureBase64 = pictureBase64;
|
||||
}
|
||||
|
||||
public void transPictureBase64() {
|
||||
if(picture != null) {
|
||||
this.pictureBase64 = "data:image/png;base64," +
|
||||
Base64.getEncoder().encodeToString(picture);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the protectedAppsMap
|
||||
*/
|
||||
public HashMap<String, String> getProtectedAppsMap() {
|
||||
|
||||
@@ -18,6 +18,7 @@
|
||||
package org.maxkey.entity.apps;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.Base64;
|
||||
|
||||
import javax.persistence.Column;
|
||||
import javax.persistence.Entity;
|
||||
@@ -78,6 +79,7 @@ public class Apps extends JpaBaseEntity implements Serializable {
|
||||
*/
|
||||
@Column
|
||||
private byte[] icon;
|
||||
private String iconBase64;
|
||||
private MultipartFile iconFile;
|
||||
@Column
|
||||
private int visible;
|
||||
@@ -270,7 +272,22 @@ public class Apps extends JpaBaseEntity implements Serializable {
|
||||
this.icon = icon;
|
||||
}
|
||||
|
||||
/**
|
||||
public String getIconBase64() {
|
||||
return iconBase64;
|
||||
}
|
||||
|
||||
public void setIconBase64(String iconBase64) {
|
||||
this.iconBase64 = iconBase64;
|
||||
}
|
||||
|
||||
public void transIconBase64() {
|
||||
if(icon !=null) {
|
||||
this.iconBase64 = "data:image/png;base64," +
|
||||
Base64.getEncoder().encodeToString(icon);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the iconFile
|
||||
*/
|
||||
public MultipartFile getIconFile() {
|
||||
|
||||
Reference in New Issue
Block a user