<?
/*
 * Smarty plugin
 * -------------------------------------------------------------
 * File:     function.imgformat.php
 * Type:     function
 * Name:     
 * Purpose:  
 * -------------------------------------------------------------
 */

function smarty_function_imgformat($param, &$smarty)
{
	$out = '';
	if(isset($param['name'])) {
		if(Mailer::$attachImages) {
			$imgContainer = Registry::Get(Mailer::$c_name);
			if(empty($imgContainer)) {
				$imgContainer = array();
			}
			$nn = md5($param['name']);
			$imgContainer[] = array('img' => $param['name'], 'name' => $nn);
			$out = 'cid:'.$nn;
			Registry::Set(Mailer::$c_name, $imgContainer);
		} else {
			$out = URL_STATIC_CONTENT . '/image/' . $param['name'];
		}
	}
	
	return $out;

    
}
?>