Просмотр поста

.
arnage

I hope that this is a good solution to display system images with width and height, since W3C MobileOK vines about it. Simply adding those attributes with empty values can't do the trick because IE doesn't display images at all so here what i come up with.
In /incfiles/classes/functions.php:

/*
-----------------------------------------------------------------
Dinamički prikaz slika
-----------------------------------------------------------------
*/
public static function display_image($what = '', $alt = '') {
if (getimagesize($what)) {
$alt = empty($alt) ? '' : $alt;
list ($width, $height) = getimagesize($what);
return '<img src="'.$what.'" width="'.$width.'" height="'.$height.'" alt="'.$alt.'"/>';
} else {
return '';
}
}

And in, for example, /incfiles/head.php:
/*
-----------------------------------------------------------------
Выводим логотип и переключатель языков
-----------------------------------------------------------------
*/
echo "\n" . '<table width="100%"><tr><td valign="bottom">'  . "\n"
. '<a href="' . $set['homeurl'] . '">'
. functions::display_image($set['homeurl'] . '/theme/' . $set_user['skin'] . '/images/logo.png', $set['copyright']) . '</a></td>' . "\n"
. ($headmod == 'mainpage' && count(core::$lng_list) > 1 
? '<td align="right"><a href="' . $set['homeurl'] . '/go.php?lng">'
. functions::display_image($set['homeurl'] . '/images/flags/' . core::$lng_iso . '.png', strtoupper(core::$lng_iso)).'</a> </td>' . "\n"
: '') . "\n" .
'</tr></table>' . "\n";