Here we’re looking at the [IMG] tag and it’s attributes SRC, ALIGN, ALT, BORDER, HEIGHT, WIDTH and USEMAP, and then the [MAP] and [AREA] tags with the NAME, SHAPE and COORDS attributes. And we’ll be coming back to the [BODY] tag briefly.
If you intend to have a webpage you’ll find that images will be unavoidable. Whether they’re photos of your product or graphical images like banners and buttons, you will need them.
To make and manipulate graphics and to manipulate photos, you’ll need a system like Paint Shop Pro which I find quite excellent. There are more out there so you can shop around but for explanation purposes in this article my reference will be PSP. A word of advice; most systems can be bought on the web and downloaded, If possible don’t!. Go to your local PC shop and buy it, that way you get the user’s manual; that is vital.
I’m going to start with photos. You can digitize them in different ways. Scan them in, download them or use a digital camera. Make sure you’ve set up a separate directory for your images so you know where to find them.
Right, let’s look at photos.
First let’s have a look at some random photos. Please select “Random pictures” on your links page.
Lots of photos but presented in a rather messy, unstructured way. Simply programmed like this:
(<>’s have been replaced with [ ]’s in order to invalidate the HTML.)
[IMG xsrc=”photo04.jpg” HEIGHT=”312″ WIDTH=”200″][BR /]
[IMG xsrc=”photo05.jpg” HEIGHT=”200″ WIDTH=”300″][BR /]
[IMG xsrc=”photo06.jpg” HEIGHT=”225″ WIDTH=”300″][BR /]
[IMG xsrc=”photo07.jpg” HEIGHT=”300″ WIDTH=”202″][BR /]
[IMG xsrc=”photo08.jpg” HEIGHT=”200″ WIDTH=”300″][BR /]
[IMG xsrc=”photo09.jpg” HEIGHT=”230″ WIDTH=”300″][BR /]
No attempt at an ordered presentation. We could have done it like this. I’ve added three more snaps.
Please select “Gallery” on your links page.
Here the use of a TABLE has given some order.
[DIV ALIGN=”center”]
[TABLE BORDER=”5″ BORDERCOLORLIGHT=”beige” BORDERCOLORDARK=”brown” WIDTH=”50%”]
[TR][TH COLSPAN=”3″]The Mike Hayes Photo Gallery
[TR]
[TD][IMG xsrc=”photo01.jpg” WIDTH=”100″ HEIGHT=”100″][/TD]
[TD][IMG xsrc=”photo02.jpg” WIDTH=”100″ HEIGHT=”100″][/TD]
[TD][IMG xsrc=”photo03.jpg” WIDTH=”100″ HEIGHT=”100″][/TD]
[/TR]
[TR]
[TD][IMG xsrc=”photo04.jpg” WIDTH=”100″ HEIGHT=”100″][/TD]
[TD][IMG xsrc=”photo05.jpg” WIDTH=”100″ HEIGHT=”100″][/TD]
[TD][IMG xsrc=”photo06.jpg” WIDTH=”100″ HEIGHT=”100″][/TD]
[/TR]
[TR]
[TD][IMG xsrc=”photo07.jpg” WIDTH=”100″ HEIGHT=”100″][/TD]
[TD][IMG xsrc=”photo08.jpg” WIDTH=”100″ HEIGHT=”100″][/TD]
[TD][IMG xsrc=”photo09.jpg” WIDTH=”100″ HEIGHT=”100″][/TD]
[/TR]
[/TABLE]
[/DIV]
As you saw in the first show of photo’s they are not actually the same size so if we stuff them into this table and make them all the same size, a size which is not proportional for each particular photo, then some distortion does occur.
Let’s continue now with the positioning of one image on a page. This series of examples are of the vertical alignment of images in respect to the line of text it’s positioned in. The first example shows the ALIGN attribute with the “bottom” option, also the default option.
Please select “ALIGN=”bottom on your links page.
Let’s look at the coding
[IMG xsrc=”http://www.my-web-site.com/test/photo02.jpg” WIDTH=”64″ HEIGHT=”96″]
This is a photo of my Jack Russell terrier, her name is Daisy and she travels all over Europe with me.[BR /]
With this option, the bottom of the image is aligned with the bottom of the current line of text.[BR /]
If an [FONT][B]IMG[/B][/FONT] statement [I]follows[/I] the text then the alignment is with the bottom of the last line of text.
[IMG xsrc=”http://www.my-web-site.com/test/photo02.jpg” WIDTH=”64″ HEIGHT=”96″]
You can manipulate so that the alignment is different. With the “middle” option for example.
Please select ALIGN=”middle” on your links page.
Let’s look at the coding.
[IMG xsrc=”http://www.my-web-site.com/est/photo02.jpg” WIDTH=”64″ HEIGHT=”96″ ALIGN=”middle”]
This is a photo of my Jack Russell terrier, her name is Daisy and she travels all over Europe with me.[BR /]
(With this option, the middle of the image is aligned with the middle of the current line of text.)
[IMG xsrc=”http://www.my-web-site.com/test/photo02.jpg” WIDTH=”64″ HEIGHT=”96″ ALIGN=”middle”]
And last the “top” option.
Please select ALIGN=”top” on your links page.
Let’s look at the coding.
[IMG xsrc=”http://www.my-web-site.com/test/photo02.jpg” WIDTH=”64″ HEIGHT=”96″ ALIGN=”top”]
This is a photo of my Jack Russell terrier, her name is Daisy and she travels all over Europe with me. [BR /]
(With this option, the top of the image is aligned with the top of the current line of text.)
[IMG xsrc=”http://www.my-web-site.com/test/photo02.jpg” WIDTH=”64″ HEIGHT=”96″ ALIGN=”top”]
So we see that these methods place the image with regard to the text line that it’s embedded in. And that could be anywhere on the page, left, right, middle.
Do you want a BORDER around your image? Well, for images that are also links, the browser will usually put a 2 pixel border round it. You can, of course, manipulate the data for this attribute. But first, let’s experiment.
If you want a border round your picture you need the BORDER attribute
Please select ALIGN=”Border” on your links page.
Coded like this.
[IMG xsrc=”images/photo09.jpg” BORDER=”10″]
As you see from the example the default color for borders is black.
Flexible images.
Imagine you’re an art teacher who gives lessons on the internet and you want to talk about some different colors. A figure/painting like this could help me.
Please select “Abstract” on your links page.
The purpose could be that when someone clicks on one of the colors they would be sent to a page or site with information of that color.
For this we need the tag MAP with it’s NAME attribute and the AREA tag with it’s SHAPE and COORDS attributes. The coding of this example is beyond the scope of this article but can be found in book mentioned below. To be clear, the MAP doesn’t have to be a graphic, a drawing; it could be e.g. a photograph of a face with links from the eyes, nose, ears, etc.
There are different sorts of image files available but we’ll most probably only use two. For photo’s, where we want a reasonable level of quality, we’re going to use the “jpeg” format and for graphics, images like banners and buttons, we use “gif”. An aspect of images which you have to pay attention to is the size as this influences the download time and as we all know, we hate waiting for the images to appear. We can improve this in two ways.
We can make our images very small to speed up the download, but then they’ll either be too small to make any impression, or, if we adjust the size with the HEIGHT and WIDTH attributes, their quality will be abominable. Look at these examples.
Please select “First two” on your links page.
As you see the top image, (size 50 by 37), is unrecognizable when small but when enlarged its dreadful!
So let’s see the real image. The first one is the original image, it’s 1280 by 960 and is 77kb. I’ve reduced it’s display size with the HEIGHT and WIDTH attributes to 500 by 375. The one that follows has been physically reduced by my graphics program to 500 by 375 and takes up 11kb of disc space!
Please select “Second two” on your links page.
Notice the difference. The first of the two is of a slightly better quality but the second is good enough and it speeds up download time considerably.
With graphics, banners, the non-photgraphic pictures, etc., I use the “gif” option.
Another way to reduce the download time is as follows. At save time choose ‘options’ and then “progressive encoding” for “jpg” files and “89a/interlaced” for “gif”. The method of saving may be different for the different graphics programs so study your documentation.