0
我在使用vb.net保存爲blob數據類型之前在重新調整圖像大小方面存在問題。我不知道如何調整圖像大小。如何在保存到數據庫之前重新調整圖像大小?
這裏是我的代碼中插入:
Dim FileSize As UInt32
Dim mstream As New System.IO.MemoryStream()
pic_box_save.Image.Save(mstream, System.Drawing.Imaging.ImageFormat.Jpeg)
Dim arrImage() As Byte = mstream.GetBuffer()
FileSize = mstream.Length
mstream.Close()
MsgBox(FileSize)
Try
sql = "INSERT INTO clientreports(report_id, img) VALUES(@image_id, @image_data)"
sql_command = New MySqlCommand(SQL, sql_connection)
sql_command.Parameters.AddWithValue("@image_id", Nothing)
sql_command.Parameters.AddWithValue("@image_data", arrImage)
sql_command.ExecuteNonQuery()
Catch ex As Exception
MsgBox(ex.Message)
Exit Sub
End Try
MsgBox("Image has been saved.")
請幫我傢伙如果有人知道如何解決這個問題。謝謝!