Vbscript / webcam. using flash API - Save streaming file as image

Posted by remi on Stack Overflow See other posts from Stack Overflow or by remi
Published on 2010-12-29T17:48:14Z Indexed on 2010/12/29 17:54 UTC
Read the original article Hit count: 331

Filed under:
|
|

Hi. Based on a php app we've tried to developp our own webapp in vbscript. All is working well. The camera starts, etc.. The problem we're left with is the following: the flash API is streaming the content of the video to a webpage, this page saves the photo as a jpg.

The PHP code we're trying to emulate is as follow

$str = file_get_contents("php://input");
file_put_contents("/tmp/upload.jpg", pack("H*", $str));

After intensive googling the best we can come up with is

    Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs)

        Dim sImagePath As String = Server.MapPath("/registration/") & "test.jpg"

        Dim data As Byte() = Request.BinaryRead(Request.TotalBytes)

        Dim Ret As Array
        Dim imgbmp As New System.Drawing.Bitmap("test.jpg")
        Dim ms As MemoryStream = New MemoryStream(data)
        imgbmp.Save(ms, System.Drawing.Imaging.ImageFormat.Jpeg)
        Ret = ms.ToArray()

        Dim fs As New FileStream(sImagePath, FileMode.Create, FileAccess.Write)
        fs.Write(Ret, 0, Ret.Length)
        fs.Flush()
        fs.Close()

    End Sub

which is not working, does anybody have any suggestion?

© Stack Overflow or respective owner

Related posts about vb.net

Related posts about flash