Re: Re: Re: [SMARTY] hello again :)

From: Date: Mon, 25 Nov 2002 19:56:20 +0000
Subject: Re: Re: Re: [SMARTY] hello again :)
Groups: php.smarty.general 
Request: Send a blank email to php-smarty-general+get-6542@lists.php.net to get a copy of this message
hmm, maybe I'm not as forgetful as I thought - that one didn't come through with an attachment either, did it? ... and this one?? apparently my attachments get stripped for some reason?? :/ alright, well, a copy/paste job will have to do then: <?php /* * Smarty plugin * ------------------------------------------------------------- * File: function.image.php * Type: function * Name: imagesize * Version: 1.0 * Date: November 25th, 2002 * Purpose: inserts an imagetag, automatically examining and * using the width and height in the HTML tag. * * Input: "src" must specify the filename of the image * * "width" and "height" optionally specify the width * and/or height of the image - if unspecified, the * plugin examines the dimensions of the image. * * "border" is optional and defaults to zero. * * Author: Rasmus Schultz <m(at)mindplay.dk> * Example: { * ------------------------------------------------------------- */ function smarty_function_img($params, &$smarty) { extract($params); if (empty($src)) { $smarty->trigger_error("image: 'src' argument required"); return false; } if (empty($width) or empty($height)) { if (!($size = getimagesize($src))) { $smarty->trigger_error("image: unable to get image information"); return false; } if empty($width) { $width = $size[0]; }; if empty($height) { $height = $size[1]; }; } if (empty($border)) { $border = 0; }; echo "<IMG SRC=\"$src\" WIDTH=$width HEIGHT=$height BORDER=$border>"; } /* vim: set expandtab: */ ?>

« previous php.smarty.general (#6542) next »