以文本方式查看主题 - Foxtable(狐表) (http://www.foxtable.com/bbs/index.asp) -- 专家坐堂 (http://www.foxtable.com/bbs/list.asp?boardid=2) ---- [求助]图片压缩 (http://www.foxtable.com/bbs/dispbbs.asp?boardid=2&id=151582) |
-- 作者:wldhj -- 发布时间:2020/6/28 16:52:00 -- [求助]图片压缩 主要实现通过图片管理器上传图片时,将照片自动压缩到200k以内(大于200K压缩至200k,小于200k不用压缩) |
-- 作者:有点蓝 -- 发布时间:2020/6/28 17:23:00 -- 没有办法。自己做个按钮,手工上传,上传前先压缩:http://www.foxtable.com/webhelp/topics/1410.htm 压缩图片参考: Dim file As String = "d:\\test.jpg" Dim img As image = getImage(file) Dim bmp As bitmap If img.width > 800 Then If 800 * (img.height / img.width) > 600 Then bmp = new bitmap(img, 800*(600/(800*(img.height/img.width))), 600) Else bmp = new bitmap(img, 800, 800 * (img.height / img.width)) End If End If bmp.save("d:\\缩略图.jpg",img.RawFormat) bmp.Dispose |