diff --git a/NEWS b/NEWS
index b54adf91..3cc5c854 100644
--- a/NEWS
+++ b/NEWS
@@ -1,3 +1,4 @@
+ - added html_image to distribution (Monte)
- added cat modifier (Monte)
- added << >> <> support to if statments (SMK, Monte)
- fix _assign_smarty_interface to not overwrite keys
diff --git a/libs/Smarty.class.php b/libs/Smarty.class.php
index a6e98f02..c29dedf7 100644
--- a/libs/Smarty.class.php
+++ b/libs/Smarty.class.php
@@ -1367,11 +1367,11 @@ class Smarty
* @param string $name
*/
function &get_registered_object($name) {
- if (!isset($this->_reg_objects[$object]))
- $this->_trigger_fatal_error("'$object' is not a registered object");
+ if (!isset($this->_reg_objects[$name]))
+ $this->_trigger_fatal_error("'$name' is not a registered object");
- if (!is_object($this->_reg_objects[$object][0]))
- $this->_trigger_fatal_error("registered '$object' is not an object");
+ if (!is_object($this->_reg_objects[$name][0]))
+ $this->_trigger_fatal_error("registered '$name' is not an object");
return $this->_reg_objects[$name][0];
}
diff --git a/libs/plugins/function.html_image.php b/libs/plugins/function.html_image.php
new file mode 100644
index 00000000..d9d69dbe
--- /dev/null
+++ b/libs/plugins/function.html_image.php
@@ -0,0 +1,61 @@
+
+ * Purpose: format HTML tags for the image
+ * Input: name = name of image (required)
+ * border = border width (optional, default 0)
+ * height = image height (optional, default actual height)
+ * image =image width (optional, default actual width)
+ * basedir= base directory for absolute paths, default
+ * is environment variable DOCUMENT_ROOT
+ *
+ * Examples: {image name="images/masthead.gif"}
+ * Output:
+ * -------------------------------------------------------------
+ */
+function smarty_function_html_image($params, &$smarty)
+{
+ $name = '';
+ $border = 0;
+ $height = null;
+ $width = null;
+ $basedir = isset($GLOBALS['HTTP_SERVER_VARS']['DOCUMENT_ROOT'])
+ ? $GLOBALS['HTTP_SERVER_VARS']['DOCUMENT_ROOT'] : null;
+
+ extract($params);
+
+ if (empty($name)) {
+ $smarty->trigger_error("html_image: missing 'name' parameter", E_USER_ERROR);
+ }
+
+ if(substr($name,0,1) == DIR_SEP) {
+ $_image_path = $basedir . DIR_SEP . $name;
+ } else {
+ $_image_path = $name;
+ }
+
+ if(!file_exists($_image_path)) {
+ $smarty->trigger_error("html_image: unable to find '$_image_path'", E_USER_ERROR);
+ }
+
+ if(!is_readable($_image_path)) {
+ $smarty->trigger_error("html_image: unable to read '$_image_path'", E_USER_ERROR);
+ }
+
+ if(!$_image_data = getimagesize($_image_path)) {
+ $smarty->trigger_error("html_image: '$_image_path' is not a valid image file", E_USER_ERROR);
+ }
+
+ return "
';
+}
+
+/* vim: set expandtab: */
+
+?>