<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>欢迎系统</title> <link type="text/css" rel="stylesheet" media="screen" href="page.css" />
<title>Photobooth.js</title>
</head>
<body> <div id="wrapper">
<h1>
<a name="Demo">HTML5 Webcam for your website</a>
</h1>
<div id="example"></div>
<div id="gallery"></div> <div class="tab_container"> <div class="tab_content standalone">
<code> container = document.getElementById( "example" );
gallery = document.getElementById( "gallery" ); myPhotobooth = new Photobooth( container ); myPhotobooth.onImage = function( dataUrl ){
var myImage = document.createElement( "img" );
myImage.src = dataUrl;
gallery.appendChild( myImage );
};
</code>
</div>
</div> <!--
<h2><a name="dataUrl">Storing dataUrls as image</a></h2>
The user clicked the camera icon, your <code>onImage()</code> function get's called and receives a dataUrl... now what? <h3>In the Browser</h3> <h3>Sending the image to the server</h3> <h3>Storing the image on the server</h3>
Storing your dataUrl as an image is easy when you know how. A dataUrl consists of two parts, seperated by a come: a meta-data section at
the start and the actual data <code>data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABgAA...</code> The String after the comma is base64 encoded binary data. So in order to save it as an image you need to 1) Split the dataUrl on the first comma
2) base64 decode the data ( emphasize on DECODE, not encode )
Every major serverside language has a built in way of doing that. E.g. PHP
$dataUrlParts = explode( ",", $dataUrl);
base64_decode( $dataUrlParts[ 1 ] ); Node.js
var dataUrl = "data:image/jpeg;base64,/9j/4AAQSkZJRgA...";
var buffer = new Buffer( dataUrl.split( "," )[ 1 ], 'base64');
require( "fs" ).writeFileSync( "image.jpg", buffer.toString( 'binary' ), "binary" ); 3) Save the result to a file and name it yourImage.png ( or jpeg, depending on the dataUrl type )
-->
</div>
<!-- Insert this line above script imports -->
<script>if (typeof module === 'object') {window.module = module; module = undefined;}</script> <!-- normal script imports etc -->
<!-- Mainly scripts -->
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="photobooth_min.js"></script>
<script type="text/javascript" src="script.js"></script>
<!-- Insert this line after script imports -->
<script>if (window.module) module = window.module;</script> </body>
<script>
// You can also require other files to run in this process
require('./renderer.js')
</script>
</html>

electron photobooth.js的更多相关文章

  1. photobooth.js

    HTML5 Webcam for your website, photobooth.js

  2. 基于HTML5实现的超酷摄像头(HTML5 webcam)拍照功能 - photobooth.js

    在线演示 WebRTC可能是明年最受关注的HTML5标准了,Mozilla为此开发了一套帮助你控制硬件的API,例如,摄像头,麦克风,或者是加速表.你可以不依赖其它的插件来调用你需要的本机硬件设备. ...

  3. electron node.js 在 vscode 设置 调试 Debug

    在当前工程下,添加一个 .vscode/launch.json 文件 { // Use IntelliSense to learn about possible attributes. // Hove ...

  4. electron node.js 实现文件拖动读取文件

    css/styles.css .for_file_drop { width: 100%; height: 100px; background-color: blueviolet; } index.ht ...

  5. photobooth.js jquery

    <div id="example" class="photobooth" style="width:758px;height:400px&quo ...

  6. electron中JS报错:require is not defined的问题解决方法

    Electron已经发布了6.0正式版,升级后发现原来能运行的代码报错提示require is not defined 解决办法: 修改创建BrowserWindow部分的相关代码,设置属性webPr ...

  7. (译)通过 HTML、JS 和 Electron 创建你的第一个桌面应用

    原文:Creating Your First Desktop App With HTML, JS and Electron 作者:Danny Markov 近年来 web 应用变得越来越强大,但是桌面 ...

  8. 记一次使用Node.js electron打包网站的记录

    具体步骤请参考:http://blog.csdn.net/a727911438/article/details/70834467 打包时出现了不少问题,逐一记录下来以供其他人参考. package.j ...

  9. 如何用Electron Js创建第一个应用Hello World

    什么是Electron Node.js和Chromium的结合品.允许只使用HTML,CSS和JavaScript来开发跨平台桌面应用. 编写第一个Electron程序(Hello World) 在开 ...

随机推荐

  1. Linux配置无线网卡驱动实现无线上网

    本机装Linux,需要配置的无线驱动.一般Ubuntu都集成无线驱动,基本上无线可以直接使用! 01.查看无线网卡的型号 [root@Mr-zhao software]# lspci    | gre ...

  2. C++中函数的默认参数和C语言中volatile的学习

    1.函数默认参数 1 int func(int a,int b=10) 2 { 3 return a*b; 4 } 5 6 int main() 7 { 8 int c=func(2); 9 cout ...

  3. Django - 获取请求方式

    //获取请过来得得请求类型 method = request.method 通过Django 的form 判断用户输入是否通过验证 check = forms.LoginFrom(request.PO ...

  4. 远程登录服务器执行cmd的Python脚本

    import paramiko,os,sys ip = raw_input("input ip address :>>>") password = raw_inp ...

  5. 【BZOJ 1038】【ZJOI 2008】瞭望塔

    http://www.lydsy.com/JudgeOnline/problem.php?id=1038 半平面交裸题,求完半平面后在折线段上的每个点竖直向上和半平面上的每个点竖直向下求距离,统计最小 ...

  6. Js-动态控制table的tr、td增加及删除的具体实现

    <table id='wifi_clients_table' style="color:#0099CC;font-size:12px;" class="table ...

  7. 控件 UI: StateTrigger

    VisualState 之 StateTrigger 示例1.自定义 StateTriggerControls/UI/VisualState/MyDeviceFamilyStateTrigger.cs ...

  8. AOPR弹出Order Now窗口怎么办

    当我们忘记了我们自己设置的office密码的时候,需要一款office密码破解软件来帮我们破解,Advanced Office Password Recovery就是这样的一款软件,其简称AOPR.试 ...

  9. DIRECTORY_SEPARATOR:PHP 系统分隔符常量

    今天在nginx部署项目,在浏览器输入http://127.0.0.2/index.php/system/category/?action=list 老是提示error nginx配置没有问题,下了其 ...

  10. bzoj2653: middle

    首先,对于每个询问,我们二分答案 然后对于序列中大于等于中位数的数,我们把它们置为1,小于中位数的数,置为-1 那么如果一个区间和大于等于0,那么就资磁,否则就不滋磁 这个区间和呢,我们可以用主席树维 ...