Padding Padding
Janet
Systems
 Register  Login 
Telephone  01628 566 178
Website Design, Hosting and Software Services
  Search 
Padding
corner Padding corner
Padding Padding
corner Padding corner
 ASP.NET Articles

Given the name of a file we will determine the width and height parameters of an image.

Let us assume that our file image is /images/kennet_avon_canal.jpg and that we are going to illustrate the information we have found by using a label control lblRandomImage.

To begin with our imports. At the very least we will need

Imports System.Drawing

We will also define the parameters which we will be using

Dim RandomImage As Bitmap
Dim Width As Integer
Dim Height As Integer

And assign our discovered values, after creating RandomImage as a new Bitmap.

RandomImage = New Bitmap(Server.MapPath(strImageName))
Height = RandomImage.Height
Width = RandomImage.Width

Finally we will set the discovered width and height parameters of the image, plus the image itself, as the text parameter of our label control.

lblRandomImage.Text = "<DIV><IMG height= src=""" & RandomImage & """ width=""" & width & """ height= """ & height&"""></DIV>"
lblRandomImage.Text = lblRandomImage.Text +"<DIV>Width = " & Width& "></DIV>"
lblRandomImage.Text = lblRandomImage.Text + "<DIV>Height = " & Height & "></DIV>"

NAT January 2006


This article viewed: 833 times Back

Copyright © 2004-2007 Janet Systems Ltd.

 Print   

DotNetNuke Website design and hosting from £15.00 per month. More...

Looking for a website design company in the Thames Valley, call us on 01628 566178

DotNetNuke Modules
DotNetNuke Modules availalble from Janet Systems

DotNetNuke Skins
DotNetNukeSkins.gif

from Janet Systems

Padding
Copyright 2002-2008 Janet Systems Ltd.   Terms Of Use  Privacy Statement Tuesday, May 13, 2008