kongdeqiang
2024-05-16 0b6189c1c208a4f1c4cd4b230dba10b3581d1ff9
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
package cn.exrick.xboot.your.util;
 
import cn.hutool.core.util.StrUtil;
 
public class ImageShowUtil {
    public static String getImgX(String imgx) {
        String temp = "";
        if (StrUtil.isEmpty(imgx)) {
            return temp;
        }
        String[] imgss = imgx.split(",");
        for (int i = 0; i < imgss.length; i++) {
            String url = imgss[i];
            if (StrUtil.isNotEmpty(url)) {
                if (url.contains("http") && url.contains("/xboot")) {
                    try{
                        if("".equals(temp)){
                            temp += "/xboot" + url.split("/xboot")[1];
                        }else{
                            temp += ",/xboot" + url.split("/xboot")[1];
                        }
                    }catch (Exception e){
                        if("".equals(temp)){
                            temp += url;
                        }else{
                            temp += "," + url;
                        }
                    }
                } else {
                    if("".equals(temp)){
                        temp += url;
                    }else {
                        temp += "," + url;
                    }
                }
            }
        }
        return temp;
    }
}