2011-06-17 28 views
0

在「保存」模式下使用jquery camera時,它似乎沒有效果。我試圖手動調用「webcam.save」中的url,它工作正常。看來,jQuery相機無法正常工作。有沒有人有任何想法?保存模式下的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> 
+0

嘗試刪除您的回調定義(onTick,onSave等),因爲您沒有使用它們,並定義調試方法輸出到控制檯並查看是否提供了任何有用的消息。 – bwest

+0

試過,調試沒有提供任何保存。 –

回答

1

您必須在調用webcam.save()之前調用webcam.capture()。嘗試添加webcam.capture();在你的webcam.save行之前的行中,它將起作用。