<!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. Bete冲刺第五阶段

    Bete冲刺第五阶段 今日工作: web: 今日做的最大的工作是成功顺利的吧web部署到阿里云服务器上了,代码顺利在公网上跑,解决了与ios的网络连接问题.同时优化了几个接口的查询逻辑,减少了对数据库 ...

  2. MyEclipse下Maven的安装配置

    Maven常用命令: •mvn archetype:generate :创建 Maven 项目 •mvn compile :编译源代码 •mvn test-compile :编译测试代码 •mvn t ...

  3. 转载--web前端35个jQuery小技巧!

    1. 禁止右键点击$(document).ready(function(){    $(document).bind("contextmenu",function(e){     ...

  4. poj3694 缩点边双连通分量

    Network Time Limit: 5000MS   Memory Limit: 65536K Total Submissions: 8669   Accepted: 3175 Descripti ...

  5. 100803C

    画个图,很容易发现少兜圈子,就是说这些限制c[i],d[i]可以看做[c[i],d[i]],不让那些区间相交,然后就可以了 #include<iostream> #include<c ...

  6. js学习笔记1---使用方法

    1.获取对象: a) 通过名称来获取元素:document.getElementById() //属于静态方法,方法前面只能用document b) document.getElementsByCla ...

  7. 使用MVVM框架时,如何处理在页面动态渲染完之后需要发生的事件呢?

    在项目实践过程中,当我们使用如avalon这样的MVVM框架时,通常会发现一直会有个问题. 过往的经验告诉我们,想在页面加载完之后处理些事件我们可以绑定document的ready方法或者使用jque ...

  8. SSM框架——详细整合教程(Spring+SpringMVC+MyBatis)【转载】

    最近在学习Spring+SpringMVC+MyBatis的整合.以下是参考网上的资料自己实践操作的详细步骤. 1.基本概念   1.1.Spring Spring是一个开源框架,Spring是于20 ...

  9. js 日报 周报 月报 时间扩展 js

    当初做统计业务需要处理时间 周报:本周 上周 下周 近一周 月报上月 本月 等 需要使用时间处理 所以扩展了这些方法 <!DOCTYPE html> <html xmlns=&quo ...

  10. Bzoj2118 墨墨的等式

    Time Limit: 10 Sec  Memory Limit: 259 MBSubmit: 1488  Solved: 578 Description 墨墨突然对等式很感兴趣,他正在研究a1x1+ ...