I’ve made somes small change to the snippet so it is valid:
Line 53, encode <b>,</b> and
replaced
$returnstring .= "<a href=\"$file\" rel=\"lightbox[maxigallery]\" title=\"<b>".htmlentities(stripslashes($pic['title']))."</b><br />".htmlentities(stripslashes($pic['descr']))."\">";
with:
$returnstring .= "<a href=\"$file\" rel=\"lightbox[maxigallery]\" title=\"<b>".htmlentities(stripslashes($pic['title']))."</b><br />".htmlentities(stripslashes($pic['descr']))."\">";
and line 59 added the alt attribute and closing img tag with "/ >"
$returnstring .= ($i > $pics_to_show ? "" : "<img src=\"$tn_file\" class=\"thumbnail\">" ) . "</a>";
with:
$returnstring .= ($i > $pics_to_show ? "" : "<img src=\"$tn_file\" class=\"thumbnail\" alt=\"".htmlentities(stripslashes($pic['title']))."\" />" ) . "</a>";