This is the code of the function I use to display the hot tunes matrix.
// This function is used to return the thumbnail picture attached to an article within textpattern.
// This is how I use it : <txp:permlink><txp:imagematrix /></txp:permlink>
function imagematrix($atts)
{
global $thisarticle,$img_dir;
extract(lAtts(array(
'style' => '',
'align' => '',
'alttxt' =>''
),$atts));
$theimage = ($thisarticle['article_image']) ? $thisarticle['article_image'] : '';
$alttxt = $thisarticle['title'];
if ($theimage) {
if (is_numeric($theimage)) {
$rs = safe_row("*",'txp_image',"id='$theimage'");
if ($rs) {
extract($rs);
$out = array(
'<img',
'src="'.hu.$img_dir.'/'.$id.$ext.'"',
'height="'.$h.'" width="'.$w.'" alt="'.$alt.'" title="'.$alttxt.'"',
(!empty($style)) ? 'style="'.$style.'"' : '',
(!empty($align)) ? 'align="'.$align.'"' : '',
' />'
);
return join(' ',$out);
}
} else {
return '<img src="'.$theimage.'" alt="'.$alttxt.'" title="'.$alttxt.'" />';
}
}
}
- Download this code:
imagematrix