|
画像をリサイズしてからResponseに出力すればいいかと。
Dim oW As Integer = 100 ' サムネイル表示サイズ横
Dim oH As Integer = 100 ' サムネイル表示サイズ縦
Dim bmp As Bitmap = Bitmap.FromStream(New MemoryStream(DirectCast(.Item("jpg_data"), Byte())))
Dim s As Double = Math.Min(oW / bmp.Width, oH / bmp.Height)
Dim sW As Integer = CInt(s * bmp.Width)
Dim sH As Integer = CInt(s * bmp.Height)
Dim outBmp As Bitmap = New Bitmap(oW, oH)
Using g As Graphics = Graphics.FromImage(outBmp)
g.DrawImage(bmp, (oW - sW) \ 2, (oH - sH) \ 2, sW, sH)
End Using
outBmp.Save(Response.OutputStream, ImageFormat.Jpeg)
(未検証)
|