Sub GeneraTumbnail(ByVal path As String, ByVal img As String, ByVal dimensione As Short)
Dim objImage, objThumbnail As System.Drawing.Image
Dim strFilename As String
Dim shtWidth, shtHeight As Short
strFilename = path & img
shtWidth = dimensione
Try
objImage = objImage.FromFile(strFilename)
Catch
'errore...
End Try
If shtWidth = Nothing Then
shtWidth = objImage.Width
ElseIf Request.QueryString("width") < 1 Then
shtWidth = 100
Else
shtWidth = Request.QueryString("width")
End If
shtHeight = objImage.Height / (objImage.Width / shtWidth)
objThumbnail = objImage.GetThumbnailImage(shtWidth, _
shtHeight, Nothing, System.IntPtr.Zero)
Response.ContentType = "image/jpeg"
objThumbnail.Save(Response.OutputStream, Imaging.ImageFormat.Jpeg)
objImage.Dispose()
objThumbnail.Dispose()
End Sub