html_image function
basedir is the base path of the relative image path. If this attribute is not given, it will be based on the root path of the WEB server (environment variable DOCUMENT_ROOT) shall prevail. If the template's security settings are turned on, the location of the image must be in a secure folder.
href is the location where the image link points. If this attribute is set, hyperlink tags will be added to both sides of the image to form an image link.
Technical points: html_image needs to access the disk to obtain the size of the image. If buffering is not used, in order to optimize performance, it is generally recommended to use static image tags and avoid using html_iamge.
eg:
index .php:
require('Smarty.class.php');
$smarty = new Smarty;
$smarty->display('index.tpl');
index.tpl:
{html_image file="pumpkin.jpg"}
{html_image file="/path/from/docroot/pumpkin.jpg"}
{html_image file="../path/relative/to/currdir/pumpkin.jpg"}
Output:
<img src="pumpkin.jpg" alt ="" border="0" width="44" height="68" />
<img src="/path/from/docroot/pumpkin.jpg" alt="" border="0" width="44" height="68" />
<img src="../path/relative/to/currdir/pumpkin.jpg" alt="" border="0" width="44 " height="68" />