Friday, 18 June 2021

*Episode 7* HTML (Images)



Introduction


        The inclusion of images in web pages adds a new dimension to the distribution of information. The inclusion of an image makes the information much more attractive, and as the saying goes, a picture is worth a thousand words.

          Including an image is your page is quite easy. It requires only that you have available the image to be displayed, and that it be in one of the formats accepted by the browser. GIF and JPG are the standard graphic file formats accepted by the web. 

          CompuServe's GIF format, shorts for graphics interchange format, can be used on different hardware platforms, such as the PC and the Mac-intosh. Compared to the standard windows format, it generates much smaller files.

          A second format considered a standard is the JPG format from the joint photographic experts group. It manages to reduce the size of an image by up to ten times. Version 2 and above of Netscape navigator and Internet explorer work with this type of file.


Obtaining the Image


        The first thing you should do is have your chosen images in one of these formats. We particularly recommend starting with the GIF format. If you have a scanner to capture the images. excellent! if not, look for a desktop publishing bureau to scan your images in the GIF or JPG format or try to download an image from the internet. Be aware of copyright restrictions!  

        There are several programs that converts BMP or other format image to GIF. Among them are sharewere paintshop, Wingif, and most of the image editing programs such as Photoshop, picture publisher, and photopaint.


Recommendations


       Before including a large number of images in your pages, remember that the transmission speed on the internet can be very slow, around 1 kb per second or, depending on the traffic, just tens of byte per second. Therefore, 100 KB image can take several minutes to be displayed, frustrating the audience. In the advanced part of this book, we will cover images in Greater detail. Meanwhile, big recommend using small images captured with the resolution of 78 pixels per inch, the resolution used in the VGA and SVGA standard of most users. The number of colours of an image influences its size. In the case of photographs, try to use 256 colour for GIF files, unless this compromises the quality. 

        At first, make things easier by placing the image files in the same directory as the page. Using the image linking feature, you can display an image which is in another directory or in another computer by specifying its URL. 

        The HTML command used to insert an image in the current position where it is specified is :


 <IMG SRC="FileName.gif"> or <IMG SRC="FileName.jpg">


        If a URL is not specified, the browser looks for the image in the current directory. Simple, isn't it? 


Important Command Options


        If you place an image close to text, you may specify the alignment of the image in relation to the text around it.

        As standard, the image is aligned with its bottom in the same line as the text. Through the ALIGN attribute, you can align the text at the bottom, which is the standard, at the middle, or at the top.


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

 <IMG ALIGN="middle" SRC="image.jpg">

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

 

       Load the Examp07a.htm file in the browser. This file generates the two figures on the next page. Analyze the contents :


 <HTML>

 <HEAD>

 <TITLE>inserting images examp07a</TITLE>

 </HEAD>

 <body>

 <h1>Images</h1>


 An image <img src="w95gp03.gif"> can be inserted into any place<p>

 In order to show and image without text around it use the<B>P</B>command before the <b>IMG</b> command.<p>


 <p> <img src="w95gp03.gif">

 <hr>


 <img align=top src="w95gp03.gif">image align using top<p>

 <img align=middle src="w95gp03.gif">image align using middle<p>

 <img align=bottom src="w95gp03.gif">image align using bottom<p>

  </body>

 </HTML>


   And see what it does :






Clickable Images (Using the Image as a Link)

         Just as text can be specified as a link, you can use the <IMG> command as an attribute of the <A HREF> command to create a hyperlink. To create a clickable image, use the following syntax:

 <A HREF="targetfile.htm"><IMG SRC="image.gif/jpg"></A>

        As an example we could use something like:

 <A HREF="intro.htm"><IMG SRC="lessons.gif"></a>

   Now let's see some examples. Open the Examp07b.htm file in the browser and view its contents :

 <HTML>
 <HEAD>
 <TITLE></TITLE>
 </HEAD>
 <BODY>
 <h1>Titles available</h1>

 <A HREF="gi.htm"><img align=middle src="w95gp03.gif"></a> Windows 95 Practical Guide

 <A HREF="gi.htm align=middle src="w95gi03.gif"></a>Initiation to Windows 95<p>
 <hr>
 Click on the cover of the book you wish to see a summary of.
 </BODY>
 </HTML>

    And its results:



         When you click on the image on the left, the following screen is displayed.



          Note that in this page we added a "previous page" link, to call the Examp07b.htm page.
         
          If you click on the image on the right, the browser will issue an error message, as the next figure shows in Netscape navigator. This is because there is no page linked to the image.


 
         During the development phase, you don't need to have ready all the pages that are called in order to test the functionality of a certain page. A temporary page like that in the next figure will suffice.



    The Examp07c.htm page has a very different appearance from the figure on above (Title Available), caused solely by the inclusion of the paragraph command between the two images.

         Here is the "vertical" page :



Foreign images:-

       Placing images in a page (inline) can be very interesting. However, this results in a slow loading time, especially when there are several images that are very large. A very useful technique is to make a link to the page using the <A HREF> command. In this way, the reader who wishes to see a certain photograph can click on the reference and is not burdened with the automatic loading time of the images as when you simply use the <IMG> command. Load the file called Examp07d.htm, the source code of which is displayed next:

 <html>
 <head>
 <title>Spain</title>
 </head>

 <body>
 <center>
 <h1>Spain</h1>
 </center>

 <br>
 Spain is an European country with one of the best tourism infrastructure. With an efficient hotel network, the country is perfect for whom likes to go back in time and wander through medieval cities like<a href="toledo2.gif"> Toledo </a>situated 70 km from Madrid or castles like <a href="castle1.gif">Oropesa</a>, which is 120 km from the capital.<p>

 </body>
 </html>

        Note that there is a new command in the first line of the body section. It is the <CENTER> </CENTER> command, which centres the text it encloses. It can be specified for a block of lines, which will be centred horizontally.



       Upon clicking on the word Oropesa, the associated image is displayed in a browser window. To return to the previous window, click on the back button. Note that this is not an HTML page, but just the figure itself. Of course, you could create a page with this figure and place explanatory text over it.



The size of the images

        On the CD accompanying this book, you will find images named Castle1 and Castle2 in the GIF and JPG formats. The image in the JPG format is smaller and faster to download. Notice the difference in size between the GIF and JPG formats.



       An image of less than 20 KB is loaded fairly quickly. On the other hand, one with 88 KB may take quite a while if the net has a lot of traffic. Our recommendation is to capture images using JPG and 16 KB of colours for photographs needing good quality and resolution, and 256 colour for those not requiring photographic quality.

👈Episode 6                                                                                                           Episode 8👉
Share This Post
PRINT THIS POST

No comments:

Post a Comment

If you have any doubts. Please let me know.

Featured post

*Episode 1* MCQ for Govt. Job/ Private Job/ MNCs

  Topic:- One Word Substitution 1) Especially skilled in storytelling  Answer:- Raconteur 2) Fear of loneliness Answer:- Eremophobia  3) Usa...