blob图片路径加密

11 篇文章 1 订阅
10 篇文章 1 订阅

一、代码
<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>blob图片路径加密</title>
    <script src="https://cdn.staticfile.org/jquery/1.10.2/jquery.min.js"></script>
    <style>
        .inputCons {
            width: 100px;
            height: 100px;
            border: 1px dashed #333;
            background-image: url('data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAANIAAADICAMAAACqCk+NAAAA/FBMVEUAAAD/biYwMDIwMTMwMDQwMDMwMTMwMTMwMTIvMDIwMTMwMTMwMDMwMDMwMTMwMDMwMTMxMTMzMzMwMTMvMTMwMTIwMTMwMTMvMTP/byUwMTMxMjIwMTMwMTMwMTMwMDMwMTMvMTP/byYwMTL/ciQvMDMvMTP/byYvMTP/byUwMTP/byUvMTI6Ojo0NDT/byYwMTP/byYwMDP/cCb/byUwMTP/byf/byUwMDAqKir/byb/byb/byb/byUwMTL/byX/byb/byb/byf/cCf/byb/cCb/cCQvMTT/byf/bST/byI1NTX/byb/byb/bib/byb/bST/ZhowMTP/byYoHgVfAAAAUnRSTlMAgIC/QKfltCxi7G1WR/SJMxgT4K2clXVdWU8j+tzUxKCOZEsV2M3GvKyEbGYIA/Lp5cmzk3lIOR8M693WzcW/vZyKcFNQQTsuHA8O4qeGeioKchPaXQAABB1JREFUeNrt3Ydy00AQxvHPiiW59xAXsB3H6YU0CKH3Xlfv/y4wYcjYcCKOcqe71ez/DX6jGZXVnYTZGp6/USNttZfG3gNYbLA6JAOFxRYsVQ7IUO0ibNTqkMH8AlKvEJDRSmtIuQEZL2VT6zaZr4IUOwgpjYpIL4/SqYy0agaUUvcQF9OD9KsdpNMdSq9VpFGe0mwZKVSnVPNhvhGlWwjjrdNc7T3oiOLbgulKRi6I9J+OYTiaD+ZJNMR8GSBRG3NlgUQlzJYJEtUwUzZIRPu4LCskauFPmSHR5TyMJcknVQX8jiUJy6SqgYt4knCLVOUBAExJW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7m0+1y+bQAAAABJRU5ErkJggg==');
            background-position: center;
            background-repeat: no-repeat;
            background-size: 100px 100px;
        }
        
        #fileInput {
            width: 100px;
            height: 100px;
            opacity: 0;
        }
        
        .tips {
            color: #f40;
        }
    </style>
</head>

<body>
    <div class="inputCons">
        <input id="fileInput" type="file" name="">
    </div>
    <p>请选择图片文件</p>
    <hr>
    <p class="tips"></p>
    <img id="imgCons" src="" alt="">
    <script>
        $("#fileInput").change(function(e) {
            e.preventDefault();
            let file = this.files[0];
            let temp = window.URL.createObjectURL(file);
            $('.tips').text("可将控制台输出的图片链接粘贴至其他浏览器进行测试。")
            $("#imgCons").attr("src", temp);
            console.log("复制blob图片地址至其他浏览器进行测试:\n\n", temp + "\n\n\n");
            console.log("%c ", 'margin-left:0px;padding:100px 100px;background-image: url("https://liujianwei695.gitee.io/minifile/images/officialAccount.jpg");background-size: 200px 200px;background-position: center;background-repeat: no-repeat;');
        });
    </script>

</body>

</html>
二、效果演示

选择图片前
选择图片前


选择图片后
选择图片后


控制台输出截图

这么happy的事情,有必要六个截图423:
在这里插入图片描述
在这里插入图片描述


标签:jQuery,HTML,blob类文件对象,图片加密


更多演示案例,查看 案例演示


欢迎评论留言!

评论 13
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

人间小美味695

您的鼓励是我创作的动力,感谢!

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值