Försöker skapa en tumbanil av en bild med denna kod:
Public Shared Function CreateTumbNail(ByVal strPath As String, ByVal strFilePath As String)
Dim objBMP As System.Drawing.Bitmap
Dim objGraphics As System.Drawing.Image
Dim maxImage As Integer = 200
'open image
objBMP = New Bitmap(strPath & GetName(strFilePath) & "." & GetExtension(strFilePath))
Dim imgw As Integer = objBMP.Width
Dim imgh As Integer = objBMP.Height
' Creating a Thumbnail with scale
Dim newimgw As Integer
Dim newimgh As Integer
If imgw > imgh Then
newimgw = maxImage
newimgh = (imgh * maxImage) / imgw
ElseIf imgh > imgw Then
newimgw = (imgw * maxImage) / imgh
newimgh = maxImage
Else
newimgw = imgw
newimgh = imgh
End If
Try
'ThumbNail it!!
objGraphics = objBMP.GetThumbnailImage(newimgw, newimgh, Nothing, IntPtr.Zero)
' creates the name
objGraphics.Save(strPath & GetName(strFilePath) & "-tumbnail." & GetExtension(strFilePath))
Catch Exp As Exception
Return Exp.ToString
End Try
End Function
Bilen skapas och läggs i mappen. Om jag dubbelklickar på den i utforskaren så visas den fint i visningsprogramet. Men om jag går in i visual studio (eller tex webbläsare ) för att hämta filen och placera den på en webbsida så visas den inte. En gamla "stora" filen visas dock som vanligt.
Någon med idéer?