imgsize.gp



Creator information
Current maintainer :Max Maischein
Author(s) :Max Maischein
Recipe homepage :<none>

Version history
The documentation file was last modified on Tue Nov 29 18:22:58 2016.

Overview
imgsize.gp is a simple image inclusion recipe that automagically generates width= and height= attributes for the images.
Compatible Genpage Versions
Version 1.0.3 and above.
Syntax
img( aImageURL )
img( aImageURL, aDescription )
img( aImageURL, aDescription, aAttributes )

In its simple form, img() returns
<IMG src="aImageURL" width="xx" height="yy">
if aImageURL results in a local URL, and the file is recognized as a .GIF or .JPeG file. xx and yy are the width respective the height of the image, as read from the file.

In its 2 parameter form, img() returns
<IMG src="aImageURL" width="xx" height="yy" alt="aDescription">
where aDescription is the alternative text that is shown as a placeholder before the image is loaded, as a tool tip when the mouse hovers over the image, or in textual browsers such as Lynx.

The three parameter form of img() allows you to specify additional attributes :
<IMG src="aImageURL" width="xx" height="yy" alt="aDescription" aAttributes>
This is usefull for example when you have a clickable image and want to have the attribute border=0.


Examples

First of all, the file imgsize.gp must be included in some content by using <!-- _GP_ recipe( "imgsize.gp" ) -->.

Let's assume that there is a file called sample.jpg in the same directory as the current content file with the size 80x60. If you look in the distribution of the documentation, you might find, that this is in fact the case.

<!-- _GP_ img("sample.jpg") -->
The above code will result in the following HTML :

<IMG src="sample.jpg">

which looks like this :


The two parameter form

<!-- _GP_ img("sample.jpg", "My logo") -->

will result in the following HTML :

<IMG src="sample.jpg" alt="My logo" >

which looks like this (note the alt= tag) :

My logo


Last but not least, the three parameter form

<!-- _GP_ img("sample.jpg", "My logo", "border=\"0\"") -->

will result in the following HTML :

<IMG src="sample.jpg" alt="My logo" border="0">

which will look like this (most usefull when you are using an image within an anchor tag) :

My logo
To-do List

Known Bugs
None known :)

Back to Top


This page generated using Genpage - Version: 1.0.7 on Wed Nov 30 16:34:11 2016

© Max Maischein
1999