weblogic을 사용하여 businesslogics (vb로 작성된 하나의 클래스) 메소드를 호출합니다. inputPath 및 경로가 해당 메소드의 이미지를 저장해야하는 위치에 있습니다. 축소판을 작성해야하며 나는 원본 image.Means를 저장해야 하나의 폴더에 masterimage를 저장하고 다른 폴더에 thumnail. 다음 코드를 사용했습니다.이미지를 폴더에 저장하는 방법
Public Function CreateThumbNails(ByVal intWidth As Integer, ByVal strInputFilePath As String, ByVal strFileName As String, ByVal strOutputFilePath As String) As String
Dim lnWidth As Integer = intWidth
Dim lnHeight As Integer = 100
Dim bmpOut As System.Drawing.Bitmap = Nothing
Try
Dim loBMP As New Bitmap(strInputFilePath)
Dim lnRatio As Decimal
Dim lnNewWidth As Integer = 0
Dim lnNewHeight As Integer = 0
If loBMP.Width < lnWidth AndAlso loBMP.Height < lnHeight Then
lnNewWidth = loBMP.Width
lnNewHeight = loBMP.Height
End If
If loBMP.Width > loBMP.Height Then
lnRatio = CDec(lnWidth)/loBMP.Width
lnNewWidth = lnWidth
Dim lnTemp As Decimal = loBMP.Height * lnRatio
lnNewHeight = CInt(lnTemp)
Else
lnRatio = CDec(lnHeight)/loBMP.Height
lnNewHeight = lnHeight
Dim lnTemp As Decimal = loBMP.Width * lnRatio
lnNewWidth = CInt(lnTemp)
End If
' *** This code creates cleaner (though bigger) thumbnails and properly
' *** and handles GIF files better by generating a white background for
' *** transparent images (as opposed to black)
bmpOut = New Bitmap(lnNewWidth, lnNewHeight)
Dim g As Graphics = Graphics.FromImage(bmpOut)
g.InterpolationMode = System.Drawing.Drawing2D.InterpolationMode.HighQualityBicubic
g.FillRectangle(Brushes.White, 0, 0, lnNewWidth, lnNewHeight)
g.DrawImage(loBMP, 0, 0, lnNewWidth, lnNewHeight)
loBMP.Dispose()
bmpOut.Save(HttpContext.Current.Server.MapPath(strOutputFilePath) + strFileName)
bmpOut.Dispose()
Return strOutputFilePath + strFileName
Catch e As Exception
Throw New Exception("ThumbNail Creation Failed")
Return ""
End Try
End Function
다른 폴더에 원본 크기의 이미지를 저장하려면 어떤 코드가 포함되어야합니까? 아무도 도움이 될 수 있습니까?
CreateThumbnails라는 메서드는 실제로 마스터 이미지의 복사본을 만드는 데 적합한 위치입니까? –