i want to resize an image before it is saved on my mysql database.. how will i process it? i have here the code for view, controller, and model.
View:
<form method="post" enctype="multipart/form-data" action="<%=url.action("PhotoInsert") %>">
<%Using Html.BeginForm()%>
<p>
<label for="despcription">Caption :</label>
<%=Html.TextArea("caption")%>
</p>
<p>
<label for="image">Image : </label>
<input type="file" id="image" name="image" />
</p>
<input type="submit" value="Insert" />
<%End Using%>
</form>
Controller:
Function PhotoInsert(ByVal caption As String, ByVal image As HttpPostedFileBase) As ActionResult
UploadDirectory = Path.GetDirectoryName(Request.PhysicalApplicationPath)
Dim fileName As String = Path.GetFileName(image.FileName)
Dim fullUploadpath As String = Path.Combine(UploadDirectory, fileName)
image.SaveAs(fullUploadpath)
dPhotos.pictureInsert(image:=image.FileName, caption:=caption)
End Function
Model:
Imports Microsoft.VisualBasic
Imports System.Data
Public Class ClassPhotosConnection
Inherits ClassConnection
Public Sub pictureInsert(ByVal image As String, ByVal caption As String)
Dim insert As String = String.Format("INSERT INTO pictures(Image, Caption) VALUES ('{0}','{1}')", image, caption)
UpdateData(insert)
End Sub
End Class
Thank you!:)