session 7 IMAGES

Images are placed in Web documents using the IMG tag. This tag is empty, and therefore has no closing tag. The basic form of the image tag is <IMG> You need to let the browser know where to find the image that it's supposed to place in the document.Images are in reality separate files. In other words, one HTML PAGE which has five graphics within it makes a total of six files required to make the page look right. These files are all stored on a Web server, but don't have to all be in the same exact place. (Often, server administrators will set up separate image directories for pictures.)In order to make the IMG tag work, you need to use an SRC attribute. SRC stands for "source," as in, "the source of this graphic." <IMG SRC="rscd1.gif">

How does the browser know where to put a graphic once it's been loaded? like the text, the browser puts a graphic wherever an image tag occurs in the HTML page It will do this as though the graphic were just another piece of the text For example, if you put an image tag between two sentences, the browser would show the first sentence, then the graphic, and then the second sentence right after the graphic.

You can also mix in text to either side of the image, or both sides: Let's say that you wanted to put a link to a copyright notice, and you wanted to draw attention to the link with a small warning symbol. It might go something like this: <A HREF="trscd1.gif"><IMG SRC="pix/warning.gif"></A>The second tag is the IMG tag. This tag allows you to put a picture on your webpage. It is stated by<img src="http://www.server.com/location/image.gif">
On the HTML document.

To make the,image clickable or link to get to another page, the HTML is: <A HREF="http://www.site.net/"<IMG SRC="generic-image.gif"></A>

The HTML To get rid of the colored border is...<IMG BORDER="0" SRC="generic-image.gif">

Getting the Right Format

The "universal" standard (at least for the near future) is the GIF file format. GIF stands for Graphic Interchange Format, and all graphical browsers use that format for in-lined images. You can use more image extensions than *.gif. More extensions you can use for a picture are *.jpg he IMG tag has a few sub-sections. Below is a list of them

src="image.gif" - The image location
width="number" - The specified width of the image
height="number" - The specified height of the image
border="number" - The amount of border an image has (like a frame for a picture)
alt="Text" - The name of the image (this shows when the image is not loaded yet)


Many artists have written me asking about protecting their images. Although there are several software which allow people who want your images to download them from your site, most people just right-click on the image and left-click on the "Save As" option. In order to stop people from right-clicking on your image and then saving it to their hard drive, you can put in this JavaScript in your page:

[This will not work for surfers who are using Netscape version 3 and earlier and I.E. users 2.0 and earlier.]

<html>

<head>

<title>

</title>

<SCRIPT LANGUAGE="JavaScript">

<!-- Begin

function right(e) {

var msg = "Sorry, I can't let you grab my picture.";

if (navigator.appName == 'Netscape' && e.which == 3) {

alert(msg);

return false;

}

if (navigator.appName ==

'Microsoft Internet Explorer' && event.button==2) {

alert(msg);

return false;

}

else return true;

}

 

function trap() {

if(document.images)

for(i=0;i<document.images.length;i++)

document.images[i].onmousedown = right;

}

// End -->

</SCRIPT>

</head>

<body onLoad="trap()">

I taught I taw a puddy tat!<br>

I did! I did tee a puddy tat!<br>

<img src="tweety.gif">

</body>

</html>

 

 

INDEX

NEXT PAGE

Music 
News
Health
 History
  Sports
Archaeology
Geography
 College Courses