Open GoogleCodeExporter opened 8 years ago
[deleted comment]
Created new .aspx file where image will be redirected and add this code on page
load
protected void Page_Load(object sender, EventArgs e)
{
System.Drawing.Image originalimg;
string strFile = DateTime.Now.ToString("dd_MMM_yymmss") + ".jpg";
FileStream log = new FileStream(Server.MapPath(strFile), FileMode.OpenOrCreate);
byte[] buffer = new byte[1024];
int c;
while ((c = Request.InputStream.Read(buffer, 0, buffer.Length)) > 0)
{
log.Write(buffer, 0, c);
}
originalimg = System.Drawing.Image.FromStream(log);
originalimg = originalimg.GetThumbnailImage(200, 200, new System.Drawing.Image.GetThumbnailImageAbort(ThumbnailCallback), IntPtr.Zero);
originalimg.Save(Server.MapPath("Images") + "\\" + strFile);
//Write jpg filename to be picked up by regex and displayed on flash html page.
log.Close();
originalimg.Dispose();
File.Delete(Server.MapPath(strFile));
Response.Write("../Images/" + strFile);
}
public bool ThumbnailCallback() { return false; }
and for more info go to this link
http://stackoverflow.com/questions/6579407/jquery-webcam-plugin-save-image-witho
ut-php/13284531#13284531
Original comment by Mr.shara...@gmail.com
on 8 Nov 2012 at 7:42
string strFile = DateTime.Now.ToString("dd_MMM_yymmss") + ".jpg";
FileStream log = new FileStream(Server.MapPath("~/upload/" + strFile),
FileMode.OpenOrCreate);
byte[] buffer = new byte[1024];
int c;
while ((c = Request.InputStream.Read(buffer, 0, buffer.Length)) > 0)
{
log.Write(buffer, 0, c);
}
//Write jpg filename to be picked up by regex and displayed on flash html page.
log.Close();
--------------------------------------------------------------------------------
-----
above is my code and working fine when i write these code on "Page_Load"
method. But it creates one file when i run the application which contains no
image. when i click on "capture" then again it creates file with having the
image..i don't want to create two file for the same purpose..I write the code
in ASP Button event also and i but it is not working. it creates only one file
having no image preview...please help me..
Original comment by jitendra...@gmail.com
on 1 Jul 2013 at 5:15
Sorry, I have never used C# or ASP.net. I cannot help you.
Please try this instead: https://github.com/Digigizmo/JS-Webcam
Original comment by jhuck...@gmail.com
on 1 Jul 2013 at 5:23
can you show me a clearer way to save the image
Original comment by jdls2...@gmail.com
on 5 Feb 2014 at 3:43
may i know how to upload Photo by capturing it by web cam. I want to implement
it into MVC .NET / ASP.NET ? Anybody can help me ? Thanks In Adv.
Original comment by aneka...@gmail.com
on 15 Apr 2014 at 10:25
If you want to use C# for camera projects, you may try out this onvif ip camera
software: http://www.camera-sdk.com/ (Currently I'm using this library to build
an onvif video server solution:
http://www.camera-sdk.com/p_23-onvif-video-server-for-ip-cameras-and-webcams-onv
if.html)
Original comment by king.rob...@gmail.com
on 30 Oct 2014 at 12:04
Original issue reported on code.google.com by
Mr.shara...@gmail.com
on 15 May 2012 at 7:25