Great Mod - thanks gratch, just what we needed...
All my work on integrating MooShow and MyGallery is now wasted!

Anyway I have slightly changed the mod and thought I'd share it. I didnt want a folder icon for each album so I changed it to the first photo of each of the albums. This is only a frontend change.
My PHP is bad so I have done it the only way I could work out!
change the getAlbumList function in gallery.func.inc.php to:-
Code: Select all
function getAlbumList($albums) {
$text = "";
$text .= "<table".getClassHTML("albumlist_table_class").">\n";
$counter = 0;
for ($i = 0 ; $i < sizeof($albums) ; $i++) {
if ($counter == 0) {
$text .= "<tr>\n";
}
$text .= "<td".getClassHTML("albumlist_table_cell_class").">\n";
$text .= "<a href=\"include/inc_module/mod_galerix/open.php?galerix_aid=".
$albums[$i]["aid"]."\">\n";
$albumID = $albums[$i]["aid"];
$picture = getFirstPicture($albumID);
$text .= "<img src=\"".checkEndSlash($GLOBALS["mod_galerix"]["picture_path"]).
$picture["t_hash"].".".$picture["f_ext"]."\" border=\"0\" width=\"45\" height=\"34\"/>\n<br/>\n";
$text .= htmlentities($albums[$i]["name"]);
$text .= "</a>\n";
$text .= "</td>\n";
$counter++;
if ($counter >= $GLOBALS["mod_galerix"]["num_albums_in_row"]) {
$text .= "</tr>\n";
$counter = 0;
}
}
$text .= "</table>\n";
return $text;
}
Next alter the getFirstPicture function in functions.inc.php to:-
Code: Select all
function getFirstPicture($albumID) {
$query = "SELECT g.pid, g.f_id, g.aid, g.caption, g.position, f.f_hash, ".
"f.f_ext, g.t_hash FROM `".
$GLOBALS["mod_galerix"]["picture_table"]."` g JOIN `".DB_PREPEND.
"phpwcms_file` f ".getJoinString("g", "f", "f_id")." WHERE g.`aid`=".
$albumID." ORDER BY g.`position` LIMIT 1";
$result = mysql_query($query)
or die(makeErrorMessage(mysql_error(), $query));
return mysql_fetch_array($result);
}

May be some of you will use this. Perhaps we could set up this as an option on the config page, I dont have enough time at the moment!
Hope you dont mind me changing this gratch!
All the best - mac