Foxtable(狐表)用户栏目专家坐堂 → 压缩图片后系统卡顿


  共有2315人关注过本帖树形打印复制链接

主题:压缩图片后系统卡顿

帅哥,在线噢!
有点蓝
  1楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:超级版主 帖子:107649 积分:547554 威望:0 精华:9 注册:2015/6/24 9:21:00
  发帖心情 Post By:2019/11/3 21:32:00 [显示全部帖子]

图片处理本身就很费资源的,特别是大图片.何况还压缩了2次

Dim ftp1 As New FtpClient
ftp1.Host=""
ftp1.Account = ""
ftp1.Password = ""
Dim r As Row = Tables("人员花名_table1").Current
Dim t11 As String = e.Form.Controls("textbox11").text
If T11>""
    If ValidPIN(r("身份证号码"))= False
        messagebox.show("请正确填写身份证号码后才能上传其相片")
        Return
    Else
        Dim ifo As new FileInfo(t11)
        If  Ifo.Length>40960 '大于40k才压缩
            Dim img1 As image = getImage(t11)
            Dim bmp1 As bitmap
            If img1.width > 400 Then
                If 400 * (img1.height / img1.width) > 300 Then
                    bmp1 = new bitmap(img1, 400*(300/(400*(img1.height/img1.width))), 300)
                Else
                    bmp1 = new bitmap(img1, 300, 300 * (img1.height / img1.width))
                End If
                bmp1.save(slt, img.RawFormat)
                bmp1.Dispose
            End If
            If ftp1.Upload(slt,"\xp\" & FileSys.GetName(T11 & Ifo.extension),True) = True Then
                r("相片")="\xp\" & FileSys.GetName(T11 & Ifo.extension)
                r.save
                '   messagebox.show(ProjectPath & "\RemoteFiles\xp\T11" & Ifo.extension)
                '  bmp1.save(ProjectPath & "RemoteFiles\xp\" & T11 & Ifo.extension)
                e.Form.Controls("textbox11").text=""
                
            Else
                Messagebox.show("上传失败,请重新上传该文件!","提示",MessageBoxButtons.OK,MessageBoxIcon.Information)
            End If
            
        Else
            'If ftp1.Upload(t11,"\xp\" & FileSys.GetName(T11 & Ifo.extension),True) = True Then
            'r("相片")="\xp\" & FileSys.GetName(T11 & Ifo.extension)
            'r.save
            'e.Form.Controls("textbox11").text=""
            
            If ftp1.Upload(t11,"\xp\" & T11 & Ifo.extension,True) = True Then
                r("相片")="\xp\" & T11 & Ifo.extension
                r.save
                e.Form.Controls("textbox11").text=""
                
            Else
                Messagebox.show("上传失败,请重新上传该文件!","提示",MessageBoxButtons.OK,MessageBoxIcon.Information)
            End If
        End If
    End If
Else
    messagebox.show("你没打开相片")
End If

 回到顶部