保存模式下的Jquery相机不保存文件

时间:2011-06-17 18:55:50

标签: javascript jquery

在“保存”模式下使用jquery camera时,似乎无效。我尝试手动调用“webcam.save”中的URL,它工作正常。似乎jquery相机无法正常工作。有没有人有任何想法?

<!DOCTYPE html>
<html>
<head>
    <title>Registration</title>
    <script type="text/javascript" src="http://localhost/ra/js/jquery.js"></script>
    <script type="text/javascript" src="http://localhost/ra/js/jquery.webcam/jquery.webcam.js"></script>
</head>
<body>
<h1>Register</h1> 
<h4>Picture</h4>
<div id="picture"></div>

<input type="button" id="take_picture" value="Take Picture" />
</body>
</html>
<script type="text/javascript">
 $("#picture").webcam({
        width: 320,
        height: 240,
        mode: "save",
        swffile: "http://localhost/ra/js/jquery.webcam/jscam.swf",
        onTick: function() {},
        onSave: function() {},
        onCapture: function() {},
        debug: function() {},
        onLoad: function() {}
});

$("#take_picture").click(function()
{
    webcam.save("http://localhost/ra/index.php/registration/do_upload_picture");
});
</script>

1 个答案:

答案 0 :(得分:1)

在调用webcam.save()之前,您必须先调用webcam.capture()。尝试添加webcam.capture();在您的webcam.save线之前的行中它将起作用。

相关问题