将IE拍照代码迁移到tsx
This commit is contained in:
@ -28,10 +28,11 @@
|
||||
pos += 4 * 320;
|
||||
//post>= 4 * 320(x轴像素) * 240(y轴像素) 表示读取图像数据完毕
|
||||
if (pos >= 4 * 320 * 240) {
|
||||
var url ='http://127.0.0.1:8081/outer/v1.0/stock/logicStock/rgbArray2Base64';
|
||||
$.post(url, {type: 'pixel', rgb: image.join('|')}, function(result){
|
||||
$('#base64image').attr('src', 'data:image/jpg;base64,' + result.data);
|
||||
});
|
||||
window.parent.postMessage({"image":image.join('|')}, '*');
|
||||
// var url ='http://127.0.0.1:8081/outer/v1.0/stock/logicStock/rgbArray2Base64';
|
||||
// $.post(url, {type: 'pixel', rgb: image.join('|')}, function(result){
|
||||
// $('#base64image').attr('src', 'data:image/jpg;base64,' + result.data);
|
||||
// });
|
||||
image = new Array();
|
||||
pos = 0;
|
||||
}
|
||||
@ -56,6 +57,13 @@
|
||||
$('#snapBtn').on('click', function() {
|
||||
webcam.capture();
|
||||
});
|
||||
|
||||
function receiveMessageFromParent ( event ) {
|
||||
console.log(event.data);
|
||||
$('#base64image').attr('src', 'data:image/jpg;base64,' + event.data.data);
|
||||
};
|
||||
|
||||
window.addEventListener('message', receiveMessageFromParent, false);
|
||||
});
|
||||
</script>
|
||||
</body>
|
||||
|
Reference in New Issue
Block a user