以文本方式查看主题

-  Foxtable(狐表)  (http://foxtable.com/bbs/index.asp)
--  专家坐堂  (http://foxtable.com/bbs/list.asp?boardid=2)
----  文件压缩求助  (http://foxtable.com/bbs/dispbbs.asp?boardid=2&id=175512)

--  作者:yifan3429
--  发布时间:2022/3/7 22:16:00
--  文件压缩求助
 Dim e As RequestEventArgs = args(0)
For Each dr As DataRow In DataTables("图库_木作定制").DataRows
    Dim file As String = dr("原始_文件地址")
    Dim img As image = getImage(file)
    Dim bmp As bitmap
    If img.width > 400 Then
        If 400 * (img.height / img.width) > 600 Then
            bmp = new bitmap(img, 400*(600/(800*(img.height/img.width))), 600)
        Else
            bmp = new bitmap(img, 400, 400 * (img.height / img.width))
        End If
    End If
    bmp.save("D:\\data\\slt\\" & dr("原始_文件夹") & "\\" & FileSys.GetName(e.FileName))
这个就是存到新的目录下,代码报错,求助老师
Next
--  作者:有点蓝
--  发布时间:2022/3/7 23:00:00
--  
报什么错?如果前面的文件夹不存在,需要先创建文件夹
--  作者:yifan3429
--  发布时间:2022/3/8 12:58:00
--  
按要求是要全部把缩略图保存到指定的 "D:\\data\\slt\\" & dr("原始_文件夹") 内
现在会保存指定的文件夹到外面,代码如下,老师看看哪里有问题
图片点击可在新窗口打开查看此主题相关图片如下:企业微信截图_20220308124840.png
图片点击可在新窗口打开查看



 If e.DataCol.Name = "原始_文件地址" Then \'如果是已结帐列的内容变动
    For Each dr As DataRow In DataTables("图库_木作定制").DataRows
        Dim file As String = dr("原始_文件地址")
        Dim file1 As String = "D:\\data\\slt\\" & dr("原始_文件夹")
        Dim img As image = getImage(file)
        Dim bmp As bitmap
        If img.width > 400 Then
            If 400 * (img.height / img.width) > 600 Then
                bmp = new bitmap(img, 400*(600/(800*(img.height/img.width))), 600)
            Else
                bmp = new bitmap(img, 400, 400 * (img.height / img.width))
            End If
        End If
        If FileSys.DirectoryExists(file1) = False Then
            FileSys.CreateDirectory(file1)
        End If
        bmp.save(file1 & "\\" & dr("原始_文件名"))
        bmp.Dispose
       
    Next
End If
--  作者:有点蓝
--  发布时间:2022/3/8 13:35:00
--  
msgbox(file1 & "\\" & dr("原始_文件名")) ‘这里显示什么路径?
        bmp.save(file1 & "\\" & dr("原始_文件名"))
        bmp.Dispose

--  作者:yifan3429
--  发布时间:2022/3/8 18:11:00
--  
很奇怪,只有三行数据
图片点击可在新窗口打开查看此主题相关图片如下:企业微信截图_20220308181014.png
图片点击可在新窗口打开查看
,显示却有4行

--  作者:有点蓝
--  发布时间:2022/3/8 19:36:00
--  
明明有7行数据呀,其它4行是空值
--  作者:yifan3429
--  发布时间:2022/3/8 23:00:00
--  
 检索后只有3行是有效的数据,其他是其他文件夹得了
--  作者:有点蓝
--  发布时间:2022/3/8 23:06:00
--  
请上传实例说明
--  作者:yifan3429
--  发布时间:2022/3/13 23:39:00
--  
If img.width > 400 Then
        If 400 * (img.height / img.width) > 600 Then
            bmp = new bitmap(img, 400*(600/(800*(img.height/img.width))), 600)
        Else
            bmp = new bitmap(img, 400, 400 * (img.height / img.width))
        End If
    End If

主要是这段代码报错。

--  作者:有点蓝
--  发布时间:2022/3/14 8:29:00
--  
报什么错?