<% ' import all relevant namespaces %>
<%@ import namespace="System" %>
<%@ import namespace="System.Drawing" %>
<%@ import namespace="System.Drawing.Imaging" %>
<%@ import namespace="System.IO" %>
<script runat="server">
Sub Page_Load()
' create New image and bitmap objects. Load the image file and put into a resized bitmap.
dim g as System.Drawing.Image = System.Drawing.Image.FromFile(server.mappath("2008.jpg"))
dim thisFormat=g.rawformat
dim imgOutput as New Bitmap(g, 58, 79)
'Set the contenttype
if thisformat.equals(system.drawing.imaging.imageformat.Gif) then
response.contenttype="image/gif"
else
response.contenttype="image/jpeg"
end if
'send the resized image to the viewer
imgOutput.save(response.outputstream, thisformat) ' output to the user
'tidy up
g.dispose()
imgOutput.dispose()
end sub
</script>
Bookmarks