1

I have a problem using the Jquery Plugin for Webcam to take a picture of the user.

Here are the codes :

$("#camera").webcam({
    width: 320,
    height: 240,
    mode: "save",
    swffile: '@Url.Content("~/Scripts/jscam.swf")',
    debug: function (type, string) {
        $('#Status').append(type + ": " + string + '<br /><br />');
    }

});

$('#takePhoto').click(function () {
    webcam.capture();
    webcam.save('/Photo/TakePhoto');
});

The debug give :

notify: Camera started

notify: Capturing started.

notify: Capturing finished.

The problem is the save, I use MVC3, and I want to call the action TakePhoto in my controler Photo, is that possible? And have you a good tutorial to retrieve the image in my controler in C#?

Thank you

4

1 回答 1

0

您想找出插件将图像数据传递给的参数。

假设参数是“WebCamImage”。

那么您的操作方法将是这样的(注意:当我在我的 Mac 上编写此代码时,尚未检查代码):

[HttpPost]
void TakePhoto(byte[] WebCamImage)
{
     System.IO.File.WriteBytesToFile('my/path.jpg', WebCamImage).
}
于 2011-12-17T12:41:43.423 回答