Websmart UK

clearpixel02

Offers Web Services for small to medium sized companies.

Websmart uk > Services > Assisted web site DIY > Html7daycourse > HtmlLesson6

table_topleft05

Menu

table_topright03

table_cornerleft03

table_cornerright03

     Websmart uk
     Services
     Products
     Customers
     Whats new
     Contact
     PrivacyPolicy

 

table_cornerleftb02

table_cornerrightb02

table_botleft02

table_botright03

table_topleft05

Ideas

table_topright03

table_cornerleft03

table_cornerright03

 

Home Business’s

 

table_cornerleftb02

table_cornerrightb02

table_botleft02

table_botright03

Basic HTML: Lesson 6

Manipulating Images

Just as I thought a Lesson, Lesson 3, was required explaining how to manipulate text, I also think one is needed on how to manipulate images. Believe it or not, manipulating images is easier than manipulating text. So, here we go.

Placement On The Page

First let's worry about placing the image somewhere on the page. The default is justified to the left. If you write an image flag on a page, the image will pop up hard left.

If you want to have an image placed in the center of the page, you might be able to guess at this point that you'd use the <CENTER> and </CENTER> commands described in Lesson 3.

But how do we get the image to the right of the page? Well, how did we get text to the right? By adding the attribute ALIGN="--" to the <P> command, right? Could it be we do the same thing here? Why yes, it could.

Here's the format:

                             <IMG ALIGN="right" SRC="image.gif">

Here's what you get using "wolf1.gif" in place of "image.gif":

Aligning Text With Images

Images don't always stand alone. You will often want text alongside them. Here you will ALIGN text along the top, the middle, or the bottom. Again, you'll use the ALIGN="--" attribute with one of these three: "top", "middle", or "bottom".

Here are the formats:

<IMG ALIGN="top" SRC="wolf1.gif"> text text text

<IMG ALIGN="middle" SRC="wolf1.gif"> text text text

<IMG ALIGN="bottom" SRC="wolf1.gif"> text text text

And here's what it all looks like:

This is text ALIGN="top"

This is text ALIGN="middle"

This is text ALIGN="bottom"

You may notice that using the top, middle, and bottom attributes only allows for one line of text and then the rest jumps down below the image.

Here's the trick to solving that. Don't use the top, middle, or bottom attribute unless you only want one line of text. If you want text to wrap around the image, use ALIGN="left" and ALIGN="right".

Even if the image is already to the left, use the ALIGN="left" attribute anyway. It allows the text to wrap around the image fully. Try it, it's quite a clever little deal.

Two At Once?

But what if you want only one line of text to come out of the middle of the image, and you want the image aligned to the right? Can you use two ALIGN="--" attributes in the same image? No.

You set the text coming out of the middle using the ALIGN="middle" attribute in the IMG flag. Then you set the image and its text to the right by surrounding the two items with the <P ALIGN="right"> and </P> commands.

Are you starting to see how a flag does only one thing? If you want two effects placed on one item, you're going to have to use two different sets of flags.

Changing Image Size

To begin this discussion, let me state that images on a computer are not like photographs. Computer images are made up of a lot of little colored dots. They're known as picture elements or "pixels" for short. So, just remember that during this part of the Primer, numbers refer to pixels rather than inches, or centimeters, or whatever. When I say pixels, I'm talking little colored dots.

Every image is made up of pixels. The more pixels per inch the image has the better, and more detailed, the image will appear. Of course, that also means the image will take up a whole lot more bytes on your hard drive. You're going to find that most images on the Web are 72 and 100 pixels per inch. Yes, there are other settings, but 72-100 is a good trade-off between loss of detail and bytes required.

Okay, so every image is made of pixels. This means that you can also denote an image by number of pixels. For example, the "wolf1.gif" image is 94 pixels high by 64 pixels wide. How do I know that? I have an expensive graphics program that tells me so. How would you know? Without a specific program, you wouldn't. You'll have to play around with the numbers in these commands a little bit, but it's easy to do.

You might also want to open the image by itself in the Netscape Navigator browser window. Do that by choosing OPEN FILE under the FILE menu. When the picture pops up, look at the title bar along the very top. The height and width should be there. Or in Internet Explorer open the file as above but right click on the picture and select properties.

Of course, you can also go out onto the Web and surf around for a shareware graphics program. One of the best is PaintShop Pro. You get it for free for 30 days and then it's around  £37.57 or so to get it for good.

Here's what you do. Denote to the image command how many pixels high by how many pixels wide you want. The "wolf1.gif" image is 64X94 pixels. If I want the image to appear smaller, I will ask for the pixels to be smaller, say 30X55. If I want it bigger, I would set the pixels larger, say 100X250. Just remember form. If you make the image smaller or larger, you must keep the same general square, rectangle, or whatever, form.

Of course, if I want to, I can totally distort the picture.

Here's the coding:

                                         <IMG HEIGHT="##" WIDTH="##" SRC="image.gif">

Notice the HEIGHT and WIDTH attributes nestled right where the ALIGN command went before. You will replace the "##" with a number of pixels for height and width.

Here are the three examples:

This is normal size:

This is 30X55:

This is 100X250:

This is 100X23:

The <HR> Flag

The WIDTH command also works on the <HR> command, except you'll use percentages. Watch this:

<HR WIDTH="40%"> gives you this:

       ___________________

<HR WIDTH="64%"> gives you this:

 ___________________________

You get the idea, yes?

That wraps it up. Try these in the comfort of your own home under the supervision of an adult. If you are an adult, then find a kid who can program the VCR to help you along.

References:

Purchase Paint Shop Pro from Amazon UK (save around 60%)                                              http://www.amazon.co.uk/exec/obidos/ASIN/B00005U2EP/websmartuk-21

 Visit Jasc the creator of PSP also get a free 30 day trial                                                           http://www.jasc.com/

 Usefull sites:

     paint shop pro foundry                                                                                                         http://www.digital-foundry.com/index_paintshop.html

     Training course on PaintShop Pro from Oxford University:                                                    http://www.oucs.ox.ac.uk/coursematerials/psp/psp5/basics.html

     Paintshop Pro Links PSP Links                                                                                               http://www.mardiweb.com/web/

     Visit the PSP User Group                                                                                                   http://www.pspug.org/

 

Lesson 5

Top

Contact WebSmart UK

Federation of Small Business link

[link opens in new window]

Member of Web Design & Developers Association
Member of UKWDA

 

This page Copyright © 2000 -

2005

 Brian Smith WebSmart UK.com All rights reserved

81 The Green, Aston Abbotts, Aylesbury, Bucks., HP22 4LY

Lesson 7