This is the code of the function I use to display the hot tunes matrix.

  1. // This function is used to return the thumbnail picture attached to an article within textpattern.
  2. // This is how I use it : <txp:permlink><txp:imagematrix /></txp:permlink>
  3.  
  4. function imagematrix($atts)
  5. {
  6. global $thisarticle,$img_dir;
  7. extract(lAtts(array(
  8. 'style' => '',
  9. 'align' => '',
  10. 'alttxt' =>''
  11. ),$atts));
  12.  
  13. $theimage = ($thisarticle['article_image']) ? $thisarticle['article_image'] : '';
  14. $alttxt = $thisarticle['title'];
  15.  
  16. if ($theimage) {
  17.  
  18. if (is_numeric($theimage)) {
  19. $rs = safe_row("*",'txp_image',"id='$theimage'");
  20. if ($rs) {
  21. extract($rs);
  22. $out = array(
  23. '<img',
  24. 'src="'.hu.$img_dir.'/'.$id.$ext.'"',
  25. 'height="'.$h.'" width="'.$w.'" alt="'.$alt.'" title="'.$alttxt.'"',
  26. (!empty($style)) ? 'style="'.$style.'"' : '',
  27. (!empty($align)) ? 'align="'.$align.'"' : '',
  28. ' />'
  29. );
  30. return join(' ',$out);
  31. }
  32. } else {
  33. return '<img src="'.$theimage.'" alt="'.$alttxt.'" title="'.$alttxt.'" />';
  34. }
  35. }
  36. }
  37.  
  38. Download this code: Click to download the above codeimagematrix