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

Sparky
  • 98,165
  • 25
  • 199
  • 285

1 Answers1

0

You want to find out what parameter the plug in is passing your image data to as such.

Let's assume the parameter is "WebCamImage".

Then your action method would be as such (note: code has not been checked as I'm writing this on my Mac):

[HttpPost]
void TakePhoto(byte[] WebCamImage)
{
     System.IO.File.WriteBytesToFile('my/path.jpg', WebCamImage).
}
Frank Rosario
  • 2,512
  • 5
  • 31
  • 47