惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

Stack Overflow Blog
Stack Overflow Blog
Recent Announcements
Recent Announcements
Microsoft Security Blog
Microsoft Security Blog
L
LINUX DO - 最新话题
P
Privacy & Cybersecurity Law Blog
Google DeepMind News
Google DeepMind News
Security Archives - TechRepublic
Security Archives - TechRepublic
云风的 BLOG
云风的 BLOG
酷 壳 – CoolShell
酷 壳 – CoolShell
博客园 - Franky
PCI Perspectives
PCI Perspectives
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻
TaoSecurity Blog
TaoSecurity Blog
CTFtime.org: upcoming CTF events
CTFtime.org: upcoming CTF events
Attack and Defense Labs
Attack and Defense Labs
Threat Intelligence Blog | Flashpoint
Threat Intelligence Blog | Flashpoint
P
Proofpoint News Feed
小众软件
小众软件
A
Arctic Wolf
C
Cybersecurity and Infrastructure Security Agency CISA
F
Fortinet All Blogs
T
Threatpost
Security Latest
Security Latest
V
Vulnerabilities – Threatpost
B
Blog RSS Feed
MongoDB | Blog
MongoDB | Blog
WordPress大学
WordPress大学
Forbes - Security
Forbes - Security
H
Hackread – Cybersecurity News, Data Breaches, AI and More
C
CERT Recently Published Vulnerability Notes
AI
AI
博客园 - 三生石上(FineUI控件)
T
Threat Research - Cisco Blogs
Recent Commits to openclaw:main
Recent Commits to openclaw:main
S
Schneier on Security
I
Intezer
The GitHub Blog
The GitHub Blog
cs.AI updates on arXiv.org
cs.AI updates on arXiv.org
V
V2EX
aimingoo的专栏
aimingoo的专栏
量子位
NISL@THU
NISL@THU
N
News and Events Feed by Topic
O
OpenAI News
Microsoft Azure Blog
Microsoft Azure Blog
C
Check Point Blog
Schneier on Security
Schneier on Security
S
Secure Thoughts
The Cloudflare Blog
J
Java Code Geeks

博客园 - 浊浊然

kkfileview5 安装 css毛玻璃效果 createjs 实现场景拖动、滚轮放大缩小 createjs 实现图片拖动 node-sass 安装不上的问题 nodejs 搭建本地服务器 微信小程序,真机上接口调不通 mysql 去除字段中 空格 制表符等 用jeesite做后台开发,新写了个前端业务系统的权限问题 uniapp 打包app 用到地图相关 升级node最新版本18.x .Error: error:0308010C js 读取url中参数值 linux php 安装oci8 electron nativefier打包网址 electron-winstaller制作安装包 h5+ 上传图片(选择图片、拍照) phpword 导出word,文件已损坏问题 Vscode 右键 open with code 没有的情况,使用以下注册表脚本 PhpSpreadsheet导出excel apache https小程序android ssl error js获取url参数,以及中文乱码问题
微信js上传图片并 展示,iphone下预览
浊浊然 · 2017-10-12 · via 博客园 - 浊浊然
    $('.addphotos').click(function(){
                    var that = $(this);
                    var ua = navigator.userAgent.toLowerCase();
                    var ios;
                    console.log(ua);
                    if (/iphone|ipad|ipod/.test(ua)) {
                        ios = true;
                    } else {
                        ios = false;
                    }
                    console.log(ios);
                    wx.chooseImage({
                        count: 1, // 默认9
                        sizeType: ['original', 'compressed'], // 可以指定是原图还是压缩图,默认二者都有
                        sourceType: ['album', 'camera'], // 可以指定来源是相册还是相机,默认二者都有
                        success: function (res) {
                            var localIds = res.localIds; // 返回选定照片的本地ID列表,localId可以作为img标签的src属性显示图片
                            var localId = localIds[0];
                            wx.uploadImage({
                                localId: localIds[0], // 需要上传的图片的本地ID,由chooseImage接口获得
                                isShowProgressTips: 1, // 默认为1,显示进度提示
                                success: function (res) {
                                    var serverId = res.serverId; // 返回图片的服务器端ID
                                    var localData;
                                    if (ios || window.__wxjs_is_wkwebview) {
                                        wx.getLocalImgData({
                                            localId: localId,
                                            success: function (res) {
                                                var localData = res.localData; // localData是图片的base64数据,可以用img标签显示var str = '<div class="shangchuan_img_xx">'+
                                                    '<img class="zhaopian" src="'+localData+'"/>'+
                                                    '<input type="hidden" name="photos[]" value="'+serverId+'">'+
                                                    '<img class="xx_img" src="{MODULE_URL}static/img/xx.png"/>'+
                                                    '</div>';
                                                that.before(str);
                                            },
                                            fail: function (res) {
                                                alert('该图片暂时无法查看')
                                            }
                                        });
                                    } else {
                                        localData = localId;
                                        var str = '<div class="shangchuan_img_xx">'+
                                            '<img class="zhaopian" src="'+localData+'"/>'+
                                            '<input type="hidden" name="photos[]" value="'+serverId+'">'+
                                            '<img class="xx_img" src="{MODULE_URL}static/img/xx.png"/>'+
                                            '</div>';
                                        that.before(str);
                                    }

                                }
                            });
                        }
                    });
                });

iphone下不能使用localId来预览图片,调用微信jssdk最新版本https://res.wx.qq.com/open/js/jweixin-1.3.0.js wx.getLocalImgData接口来获取图片base64数据进行预览