Dim e As RequestEventArgs = args(0)
Dim path As String = "foxtableAppTest"
Dim wb As New weui
wb.AddPageTitle("","xp","相片上传","近期正面规范证件照")
wb.AddForm("","form1","xsxpcjsave.htm")
wb.InsertHTML("form1","<div style='height: 150px'><span style='position:absolute;margin-top:60px;margin-left:20px;'>学生照片:</span><img src='./xp/" & e.Cookies("xssfzh") & ".jpg' style='height: 150px;width:120px;margin-left:120px;max-height:100%'></div>")
If ReadSex(e.Cookies("xssfzh"))= "女"
wb.InsertHTML("form1","<div style='height: 150px'><span style='position:absolute;margin-top:80px;margin-left:20px;'>样板照片:</span><div id='imgs'><img src='./xp/yb.jpg' style='height:150px;width:120px;margin-top:20px;margin-left:120px;max-height:100%;'></div></div><br/>")
End If
If ReadSex(e.Cookies("xssfzh"))= "男"
wb.InsertHTML("form1","<div style='height: 150px;width:120px;'><span style='position:absolute;margin-top:80px;margin-left:20px;'>样板照片:</span><div id='imgs'><img src='./xp/yb1.jpg' style='height:100%;width:100%;margin-top:20px;margin-left:120px;max-height:100%;'></div></div><br/>")
End If
With wb.AddPageFooter("form1","pf1","")
With wb.AddButtonGroup("form1","btg1",False)
.Add("btn1", "拍照", "button").Attribute = """
.Add("btn1", "上传")
.Add("btn1","退出","button").Attribute=""
End With
End With
wb.AppendHTML("<script type='text/javascript' src='/" & path & "/js/camera.js'></script>")
wb.AppendHTML("<script type='text/javascript' src='/" & path & "/js/common.js'></script>", True)
e.WriteString(wb.Build)
Dim e As RequestEventArgs = args(0)
Dim wb As new weui
For Each key As String In e.PostValues.Keys
If key.Contains("imgs_") Then
Dim bs As Byte() = Convert.FromBase64String(e.PostValues(key).split(",")(1))
Dim stream As System.IO.Stream = New System.IO.MemoryStream(bs)
Dim bmp As System.Drawing.Bitmap = New System.Drawing.Bitmap(stream)
bmp.Save("c:\web\xp\" & e.Cookies("xssfzh") & ".jpg", ImageFormat.Jpeg)
Dim slt As String ="c:\web\xp\" & e.Cookies("xssfzh") & ".jpg"
Dim img1 As image = getImage(slt)
Dim bmp1 As bitmap
If img1.width > 200 Then
If 200 * (img1.height / img1.width) > 150 Then
bmp1 = new bitmap(img1, 200*(150/(200*(img1.height/img1.width))), 150)
Else
bmp1 = new bitmap(img1, 150, 150 * (img1.height / img1.width))
End If
End If
bmp1.save(slt, ImageFormat.Jpeg)
bmp1.Dispose
End If
Next
With wb.AddMsgPage("","msgpage","上传成功", "") '生成成功提示页
' .AddButton("btn1","返回","javascript:history.back()")
End With
e.WriteString(wb.Build)
请问老师,拍照压缩并上传,一直都是这个问题:1、是上传慢;2、是基本要死机返回,除非图片较小,这该怎么来提高效果?