PHP Resources
Home
Books
Directories
Magazines
Non-English Sites
Online Communities
Tools
Tutorials and Articles
Web Hosting
PHP Functions
PHP News Groups *
PHP Reference
Smarty Reference
Pear Reference
PHP-GTK Reference

By submitting PHP Resources you own, or know of, you'll help us build the largest PHP Resource website on the net. Please double check that your resource doesn't already exist before you submit it!!. We thank you for helping make this a better website.









Resource Image Newest ResourcesPopular ResourcesTop Resources Resource Image
PHP Resources
{html_image}

{html_image}

{html_image} is a custom function that generates an HTML <img> tag. The height and width are automatically calculated from the image file if they are not supplied.

Attribute NameTypeRequiredDefaultDescription
filestringYesn/aname/path to image
heightstringNoactual image heightHeight to display image
widthstringNoactual image widthWidth to display image
basedirstringnoweb server doc rootDirectory to base relative paths from
altstringno""Alternative description of the image
hrefstringnon/ahref value to link the image to
path_prefixstringnon/aPrefix for output path

  • basedir is the base directory that relative image paths are based from. If not given, the web server's document root $_ENV['DOCUMENT_ROOT'] is used as the base. If $security is enabled, the path to the image must be within a secure directory.

  • href is the href value to link the image to. If link is supplied, an <a class="blue" HREF="res_LINKVALUE"><a> tag is placed around the image tag.

  • path_prefix is an optional prefix string you can give the output path. This is useful if you want to supply a different server name for the image.

  • All parameters that are not in the list above are printed as name/value-pairs inside the created <img> tag.

Technical Note: {html_image} requires a hit to the disk to read the image and calculate the height and width. If you don't use template caching, it is generally better to avoid {html_image} and leave image tags static for optimal performance.

Example 8-11. {html_image} example

{html_image file='pumpkin.jpg'}
{html_image file='/path/from/docroot/pumpkin.jpg'}
{html_image file='../path/relative/to/currdir/pumpkin.jpg'}

Example output of the above template would be:

<img src="pumpkin.jpg" alt="" width="44" height="68" />
<img src="/path/from/docroot/pumpkin.jpg" alt="" width="44" height="68" />
<img src="../path/relative/to/currdir/pumpkin.jpg" alt="" width="44" height="68" />




Featured




Featured
PHP Code Examples
web site templates
Learn PHP playing Trivia
PHP & MySQL Forums
Web Development Index

List Your ResourceUpdate Your Resource

Copyright © 2006 - 2008 MickMel Inc