has anyone gotten this http://www.xarg.org/project/jquery-webcam-plugin/, to work with aps.net mvc 3? I can\'t seem to decode the image, using the WebImage class or BitmapIm
The documentation contains many examples. All that's needed is to read and try out.
So here's how your Index.cshtml
view might look like using the browser's HTML5 canvas element to encode the raw image data coming from the webcam into a PNG image that will be sent to the server using an AJAX request:
Capture image and send for processing
and your Home controller:
public class HomeController : Controller
{
public ActionResult Index()
{
return View();
}
[HttpPost]
public ActionResult Upload(string image)
{
image = image.Substring("data:image/png;base64,".Length);
var buffer = Convert.FromBase64String(image);
// TODO: I am saving the image on the hard disk but
// you could do whatever processing you want with it
System.IO.File.WriteAllBytes(Server.MapPath("~/app_data/capture.png"), buffer);
return Json(new { success = true });
}
}