Dim e As RequestEventArgs = args(0)
Dim wb As New weui
Dim path As String = "foxtableAppTest"
Dim ftp1 As New FtpClient
ftp1.Host="47.92
ftp1.Account = "ftp“
ftp1.Password = "abdc"
If e.PostValues.Count = 0 Then
wb.AddForm("","form1","xpcj.htm")
wb.AppendHTML("<script type='text/javascript' src='/" & path & "/js/common.js'></script>", True)
wb.AppendHTML("<link rel='stylesheet' href='/" & path & "/css/common.css' Type='text/css' charset='utf-8'/>", True)
With wb.AddInputGroup("form1","ipg1","客户资料")
With .AddUploader("up1","照片",True)
.AddImage("./images/001.jpg") (远程可能存在文件为 e.Cookies("username") & Ifo.extension 的图片,如果有在这里显示,这里该如何写)
.TextPosition = 0 '标题靠左
End With
End With
With wb.AddButtonGroup("form1","btg1",True)
.Add("btn1", "拍照", "button").Attribute = """ (不管e.Cookies("username") & Ifo.extension 的图片是否存在, 如果点拍照调出拍照后都要将原有的图像在控制里显示覆盖)
.Add("btn2", "上传", "sumit") (点上传就按现有图片进行压缩提交到远程)
End With
e.WriteString(wb.Build) '生成网页
Else
For Each key As String In e.Files.Keys
For Each fln As String In e.Files(key)
e.SaveFile(key,fln,"d:\web\uploadfiles\" & fln)
Dim ifo As new FileInfo("d:\web\uploadfiles\" & fln)
Dim img As image = getimage("d:\web\uploadfiles\" & fln)
Dim bmp As new bitmap(img.width, img.height)
Dim g = graphics.fromimage(bmp)
' messagebox.show(fln)
g.DrawImage(img, 0, 0, img.Width, img.Height)
Dim jpgEncoder As ImageCodecInfo
Dim codecs() As ImageCodecInfo = ImageCodecInfo.GetImageDecoders
For Each codec As ImageCodecInfo In codecs
If (codec.FormatID = ImageFormat.Jpeg.Guid) Then
jpgEncoder = codec
Exit For
End If
Next
Dim myEncoder As System.Drawing.Imaging.Encoder = System.Drawing.Imaging.Encoder.Quality
Dim myEncoderParameters As EncoderParameters = New EncoderParameters(1)
Dim myEncoderParameter As EncoderParameter = New EncoderParameter(myEncoder, 10) ' 质量级别 0 对应于最大压缩,而质量级别 100 对应于最小压缩
myEncoderParameters.Param(0) = myEncoderParameter
Dim slt As String = ifo.path & e.Cookies("username") & ifo.Extension
bmp.Save(slt,jpgEncoder, myEncoderParameters)
bmp.dispose
g.dispose
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)
bmp1.Dispose
If ftp1.Upload(slt,"\xp\" & FileSys.GetName(e.Cookies("username") & Ifo.extension),True) = True Then
' Messagebox.show("文件上传完成,请正确填写资料信息!","提示",MessageBoxButtons.OK,MessageBoxIcon.Information)
End If
Next
Next
With wb.AddMsgPage("","msgpage","上传成功", "") '生成成功提示页
.AddButton("btn6","返回","cjsc.htm")
End With
wb.AppendHTML("<script src='./lib/order.js'></script>") '引入
e.WriteString(wb.Build)
End If
老师,我看了一下,现在就像片问题只有组合成这样了,但一直对如何实现打包可调用摄像头弄不好,请老师帮写一下,蓝色部分与扫码输入例子一样的内容,谢谢,另外,关于锁定当前记录问题,我是有一个保存提交键,保存时不锁定,另有一个单独的锁定键,当要锁定记录时点锁定,是不是要用js代码来锁定,如何写?
[此贴子已经被作者于2018/4/6 20:21:29编辑过]