以文本方式查看主题 - Foxtable(狐表) (http://foxtable.com/bbs/index.asp) -- 专家坐堂 (http://foxtable.com/bbs/list.asp?boardid=2) ---- 二进制列中图片的校验码 (http://foxtable.com/bbs/dispbbs.asp?boardid=2&id=131392) |
-- 作者:无限5180 -- 发布时间:2019/2/25 13:23:00 -- 二进制列中图片的校验码 老师,我采用后台上传图片到二进制列时发现,上传之前图片的校验码与上传完了之后再下载的本地的图片的校验码不一致,这是怎么回事呢? 上传图片至二进制列的代码 Dim fx As String = pth & bh & ".png" Dim imgStream As New IO.MemoryStream \'声明 图片流 为新的 io临时储存空间 Dim b As New Bitmap(fx) Dim wj As String = FileSys.GetName(fx) Dim sx As String = CRCCheckFile(fx) b.Save(imgStream, System.Drawing.Imaging.ImageFormat.png) \'原为照片格式是jpeg Dim imageByte As Byte() = imgStream.GetBuffer \' imgStream.Dispose() \'处理 Dim ImageString As String = BitConverter.ToString(imageByte).Replace("-", "") \' Dim cmd As SQL Command = new SQL Command() cmd.Conne cti cmd.Comm andText = "up date {表} set 照片 = 0x" + ImageString + ",校验值 = \'" & sx & "\',文件名 = \'" & wj & "\' where 编号 = \'" & bh & "\' and ID = \'" & xtid & "\'" cmd.ExecuteNonQuery() 图片能成功上传,但下载后与本地的校验码不匹配 下面使用命令检查时发现: Dim drs As DataRow= Tables("全表").Current.DataRow Dim ss As String = drs("编号") & ".png" Dim pth As String = ProjectPath & "Attachments\\图片\\" Dim fl As String = pth & ss drs.SQLLoadFile("照片",fl) Dim sx1 As String = CRCCheckFile(fl) \'从二进制列下载下来图片的校验值 Dim sxx1 As String = CRCCheckFile("C:\\建筑装饰管理系统mobile\\Attachments\\" & ss) \'用于上传二进制图片的校验值 output.show("二进制列保存的校验值:" & drs.SQLGetValue("校验值") & "-下载到本地图片校验值:" & sx1 & "-用于上传的图片校验值:" & sxx1) 结果显示:二进制列保存的校验值:0xceec0a4e-下载到本地图片校验值:0x337bcaf7-用于上传的图片校验值:0xceec0a4e 导致每次校验不成功后重新下载,但下载后又再次验证不通过继续重新下载.我应该怎么处理呢 [此贴子已经被作者于2019/2/25 13:25:03编辑过]
|
-- 作者:有点甜 -- 发布时间:2019/2/25 15:21:00 --
每次下载后,或者修改以后,更新一下数据库的【检验值】,这样下次对比就没问题了
|
-- 作者:无限5180 -- 发布时间:2019/2/25 18:32:00 -- 如何在移动端显示后台二进制图片 老师,如何在移动端显示后台二进制图片 Select
Case e.Path Case "test.htm" Dim wb As New weui wb.AddForm("","form1","test.htm") With wb.AddInputGroup("form1","ipg1","文件上传") \'文件上传 .AddUploader("up1","") End With With wb.AddInputGroup("form1","ipg22","文件上传") \'带图片浏览的文件上传 With .AddUploader("up2","图片",True) \'True表示允许一次上传多个文件 .AddImage("./images/001.jpg") .AddImage("./images/002.jpg") .AddImage("./images/003.jpg") End With End With With wb.AddButtonGroup("form1","btg1",True) .Add("btn1", "确定", "submit") End With e.WriteString(wb.Build) \'生成网页 End Select 老师,红色字体显示图片的方法,能不能直接从后台调取二进制列图片?
|
-- 作者:有点蓝 -- 发布时间:2019/2/25 21:15:00 -- 参考:http://www.foxtable.com/bbs/dispbbs.asp?boardid=2&Id=101844 |