美文网首页
网络图片URL内容进行Base64处理

网络图片URL内容进行Base64处理

作者: 程序员网址导航 | 来源:发表于2020-04-21 21:42 被阅读0次

    原文链接:http://106.13.94.122/to/blog/streamline?uuid=179

    实现步骤

    (1)请求URL获取图片资源
    (2)得到图片的二进制数据,以二进制封装得到数据
    (3)对字节数组Base64编码

    工具类

    import org.apache.commons.lang3.StringUtils;
    import sun.misc.BASE64Encoder;
    
    import java.io.ByteArrayOutputStream;
    import java.io.InputStream;
    import java.net.HttpURLConnection;
    import java.net.URL;
    
    /***
     * 图片处理工具类
     **/
    public class ImageUtil {
    
        /***
         * 将图片文件转化为字节数组字符串,并对其进行Base64编码处理
         * @param imgUrl 图片的网络URL
         * @return
         */
        public static String encodeImageToBase64(String imgUrl) {
    
            if (StringUtils.isBlank(imgUrl)) {
                return null;
            }
    
            URL url;
            HttpURLConnection conn;
            try {
                url = new URL(imgUrl);
                conn = (HttpURLConnection) url.openConnection();
                // 设置Http请求头为GET
                conn.setRequestMethod("GET");
                // 设置超时响应时间为5s
                conn.setConnectTimeout(5 * 1000);
                // 通过输入流获取图片资源
                InputStream is = conn.getInputStream();
                // 得到图片的二进制数据,以二进制封装得到数据
                ByteArrayOutputStream os = new ByteArrayOutputStream();
                // 创建一个Buffer字符串
                byte[] buffer = new byte[1024];
                // 每次读取的字符串长度,如果为-1,代表全部读取完毕
                int len = 0;
                // 使用一个输入流从buffer里把数据读取出来
                while ((len = is.read(buffer)) != -1) {
                // 用输出流往buffer里写入数据,中间参数代表从哪个位置开始读,len代表读取的长度
                    os.write(buffer, 0, len);
                }
                // 关闭输入流
                is.close();
                byte[] data = os.toByteArray();
                // 对字节数组Base64编码
                BASE64Encoder encoder = new BASE64Encoder();
                return encoder.encode(data);
            } catch (Exception e) {
                Logger.err(ImageUtil.class, "encodeImageToBase64 err.", e);
            }
            return null;
        }
    }
    

    测试

     public static void main(String[] args) {
        System.out.println(encodeImageToBase64("https://upload.jianshu.io/users/upload_avatars/14814543/caf376b7-107d-49e2-b1b5-a052fc23f181.png?imageMogr2/auto-orient/strip|imageView2/1/w/240/h/240"));
        }
    

    输出:

    /9j/4AAQSkZJRgABAQAAAQABAAD/2wBDAAgGBgcGBQgHBwcJCQgKDBQNDAsLDBkSEw8UHRofHh0a
    HBwgJC4nICIsIxwcKDcpLDAxNDQ0Hyc5PTgyPC4zNDL/2wBDAQkJCQwLDBgNDRgyIRwhMjIyMjIy
    MjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjL/wAARCADwAPADASIA
    AhEBAxEB/8QAHAAAAgIDAQEAAAAAAAAAAAAAAwQCBQABBgcI/8QAOhAAAgEDAwIFAwMDAgQHAQAA
    AQIDAAQRBRIhMUEGEyJRYRQycQdCgSNSkbHBFTNDchYkJWJjoeHw/8QAGQEAAgMBAAAAAAAAAAAA
    AAAAAAECAwQF/8QAIhEAAgICAwADAQEBAAAAAAAAAAECEQMhBBIxEyJBUUJh/9oADAMBAAIRAxEA
    PwDzqTRp4beOWRdu7oPalkbZlSDkVOTXbidUWUgqvaoytubcAeas2VkmJ8vch5PWlhM6k0WENvIP
    ShSBRJTAbttVktjyeKv7HVIrs4LYJrkiBg9alAzRsCpIxScbA9FWJSgO6hTQo4461z1tq0gXazZq
    4s7lZox6hmqmmiQUK8IGeRTEbhl9jWB1K4aosM/YM0qAOvzWPnt0qESyZG4U0oBGMUhgUHFTGDRR
    HkVAphwKB0S2jFa8vPSiiOpquBSbAGsZ71sqOlHAAHNR2gtmkMF5ee1Y8PGRRjithhQvQFgprZK9
    AcGit0OKA8eQScKfmpiBsoJ96WlKocMaXutRELbI/U3citwtHLgscsaZCQNt7nA4FYYgBThQAYFC
    cYBzTRGhJ05oTLh8U03NDYZNSTHQnIuMilnT4pyRTmgODimRORgRnmVewPNWMhCP8AVGOJLdc/ur
    Z/qNnt3qxuyQUODDuIxS8O15CTzWriXKbF6UqCwYYOKKAcklAkKhRWO48nHGaVVZZHwoJJq3sdDu
    Lgg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6A1bWujWttzFEu4c5apJA8qXhz+g2Ys7t
    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/2Q==
    

    访问方式

    在访问格式:data:image/png;base64, base64后的值

    如下:

    data:image/png;base64,/9j/4AAQSkZJRgABAQAAAQ ……
    
    image.png

    相关文章

      网友评论

          本文标题:网络图片URL内容进行Base64处理

          本文链接:https://www.haomeiwen.com/subject/dbumihtx.html