Fix: Use of options on img was not correct

This commit is contained in:
Laurent Destailleur
2011-01-14 21:30:19 +00:00
parent b934beecaa
commit 15cad39815
2 changed files with 10 additions and 10 deletions

View File

@@ -314,8 +314,8 @@ if ($mode != 4)
//if (is_array($objMod->phpmin)) $alttext.=($alttext?' - ':'').'PHP >= '.join('.',$objMod->phpmin); //if (is_array($objMod->phpmin)) $alttext.=($alttext?' - ':'').'PHP >= '.join('.',$objMod->phpmin);
if (! empty($objMod->picto)) if (! empty($objMod->picto))
{ {
if (preg_match('/^\//i',$objMod->picto)) print img_picto($alttext,$objMod->picto,'',1); if (preg_match('/^\//i',$objMod->picto)) print img_picto($alttext,$objMod->picto,' width="14px"',1);
else print img_object($alttext,$objMod->picto); else print img_object($alttext,$objMod->picto,' width="14px"');
} }
else else
{ {

View File

@@ -1193,14 +1193,13 @@ function dol_trunc($string,$size=40,$trunc='right',$stringencoding='UTF-8')
* @param alt Text of alt on image * @param alt Text of alt on image
* @param object Objet pour lequel il faut afficher le logo (example: user, group, action, bill, contract, propal, product, ...) * @param object Objet pour lequel il faut afficher le logo (example: user, group, action, bill, contract, propal, product, ...)
* Pour les modules externe utiliser nomimage@mymodule pour rechercher dans le repertoire "img" du module * Pour les modules externe utiliser nomimage@mymodule pour rechercher dans le repertoire "img" du module
* @param cssclass Define a specific css class * @param options Add more attribute on img tag
* @return string Return img tag * @return string Return img tag
*/ */
function img_object($alt, $object, $cssclass='') function img_object($alt, $object, $options='')
{ {
global $conf,$langs; global $conf,$langs;
$cssclass = (!empty($cssclass)?' class="'.$cssclass.'"':'');
$path = 'theme/'.$conf->theme; $path = 'theme/'.$conf->theme;
$url = DOL_URL_ROOT; $url = DOL_URL_ROOT;
@@ -1212,7 +1211,7 @@ function img_object($alt, $object, $cssclass='')
if (DOL_URL_ROOT_ALT && ! file_exists(DOL_DOCUMENT_ROOT.'/'.$path.'/img/object_'.$object.'.png')) $url = DOL_URL_ROOT_ALT; if (DOL_URL_ROOT_ALT && ! file_exists(DOL_DOCUMENT_ROOT.'/'.$path.'/img/object_'.$object.'.png')) $url = DOL_URL_ROOT_ALT;
} }
return '<img src="'.$url.'/'.$path.'/img/object_'.$object.'.png" border="0" alt="'.dol_escape_htmltag($alt).'" title="'.dol_escape_htmltag($alt).'"'.$cssclass.'>'; return '<img src="'.$url.'/'.$path.'/img/object_'.$object.'.png" border="0" alt="'.dol_escape_htmltag($alt).'" title="'.dol_escape_htmltag($alt).'"'.($options?' '.$options:'').'>';
} }
/** /**
@@ -1237,6 +1236,7 @@ function img_picto($alt, $picto, $options='', $pictoisfullpath=0)
{ {
$picto = $regs[1]; $picto = $regs[1];
$path = $regs[2]; $path = $regs[2];
// If img file not into standard path, we use alternate path
if (DOL_URL_ROOT_ALT && ! file_exists(DOL_DOCUMENT_ROOT.'/'.$path.'/img/'.$picto)) $url = DOL_URL_ROOT_ALT; if (DOL_URL_ROOT_ALT && ! file_exists(DOL_DOCUMENT_ROOT.'/'.$path.'/img/'.$picto)) $url = DOL_URL_ROOT_ALT;
} }