4 album horizonal view

chrispy

Joined: 2003-11-11
Posts: 14
Posted: Tue, 2003-11-11 08:54

hi im trying to figure out how to modify my gallery to appear like this....
http://www.sapphirestudios.net/gallery/introspective

there album thumbs are arranged as follows:

album1 album2 album3 album4
descr1 descr2 descr3 descr4

does anyone have any ideas? this is driving me crazy :evil:

 
chrispy

Joined: 2003-11-11
Posts: 14
Posted: Tue, 2003-11-11 21:59

so i was able to get the descriptions below each album thumb, but i still can't figure out how to have the albums appear horizontally.

someone please help me.....

my gallery is at http://pce.chrispy.biz/gallery/

my albums.php is as follows:
<?php
// Hack prevention.
if (!empty($HTTP_GET_VARS["GALLERY_BASEDIR"]) ||
!empty($HTTP_POST_VARS["GALLERY_BASEDIR"]) ||
!empty($HTTP_COOKIE_VARS["GALLERY_BASEDIR"])) {
print _("Security violation") ."\n";
exit;
}
?>
<?php if (!isset($GALLERY_BASEDIR)) {
$GALLERY_BASEDIR = './';
}
require($GALLERY_BASEDIR . 'init.php'); ?>
<?php
$gallery->session->offlineAlbums["albums.php"]=true;

/* Read the album list */
$albumDB = new AlbumDB(FALSE);
$gallery->session->albumName = "";
$page = 1;

/* If there are albums in our list, display them in the table */
$numAlbums = $albumDB->numAlbums($gallery->user);
$numPhotos = $albumDB->getCachedNumPhotos($gallery->user);
$numAccess = $albumDB->numAccessibleAlbums($gallery->user);

if (!$gallery->session->albumListPage) {
$gallery->session->albumListPage = 1;
}
$perPage = $gallery->app->default["albumsPerPage"];
$maxPages = max(ceil($numAlbums / $perPage), 1);

if ($gallery->session->albumListPage > $maxPages) {
$gallery->session->albumListPage = $maxPages;
}

$imageDir = $gallery->app->photoAlbumURL . '/images';
$pixelImage = "<img src=\"$imageDir/pixel_trans.gif\" width=\"1\" height=\"1\">";
$borderColor = $gallery->app->default["bordercolor"];

$navigator["page"] = $gallery->session->albumListPage;
$navigator["pageVar"] = "set_albumListPage";
$navigator["url"] = makeGalleryUrl("albums.php");
$navigator["maxPages"] = $maxPages;
$navigator["spread"] = 6;
$navigator["fullWidth"] = 100;
$navigator["widthUnits"] = "%";
$navigator["bordercolor"] = $borderColor;

?>
<?php if (!$GALLERY_EMBEDDED_INSIDE) { ?>
<html>
<head>
<title><?php echo $gallery->app->galleryTitle ?></title>
<?php echo getStyleSheetLink() ?>
<?php /* prefetching/navigation */
if ($navigator['page'] > 1) { ?>
<link rel="top" href="<?php echo makeGalleryUrl('albums.php', array('set_albumListPage' => 1)) ?>" />
<link rel="first" href="<?php echo makeGalleryUrl('albums.php', array('set_albumListPage' => 1)) ?>" />
<link rel="prev" href="<?php echo makeGalleryUrl('albums.php', array('set_albumListPage' => $navigator['page']-1)) ?>" />
<?php }
if ($navigator['page'] < $maxPages) { ?>
<link rel="next" href="<?php echo makeGalleryUrl('albums.php', array('set_albumListPage' => $navigator['page']+1)) ?>" />
<link rel="last" href="<?php echo makeGalleryUrl('albums.php', array('set_albumListPage' => $maxPages)) ?>" />
<?php } ?>
</head>
<body dir=<?php echo $gallery->direction ?>>
<?php } ?>
<?php
includeHtmlWrap("gallery.header");
?>
<?php
if (!$gallery->session->offline && !strcmp($gallery->app->default["showSearchEngine"], "yes")) {
?>
<table width=100% border=0 cellspacing=0>
<tr><?php echo makeFormIntro("search.php"); ?>
<td valign="middle" align="right">
<span class="admin"> <?php echo _("Search") ?>: </span>
<input style="font-size=10px;" type="text" name="searchstring" value="" size="25">
</td>
</form>
</tr>
<tr><td height=2><img src=<?php echo $gallery->app->photoAlbumURL ?>/images/pixel_trans.gif></td></tr></table>
<?php
}
?>
<!-- admin section begin -->
<?php
$adminText = "<span class=\"admin\">";
$toplevel_str= pluralize_n($numAlbums, ($numAccess != $numAlbums) ? _("top-level album") : _("album"), ($numAccess != $numAlbums) ? _("top-level albums") : _("albums"), _("No albums"));
$total_str= sprintf(_("%d total"), $numAccess);
$image_str= pluralize_n($numPhotos, _("image"), _("images"), _("no image"));
$page_str= pluralize_n($maxPages, _("page"), _("pages"), _("no pages"));

if (($numAccess != $numAlbums) && $maxPages > 1) {
$adminText .= sprintf(_("%s (%s), %s on %s"), $toplevel_str, $total_str, $image_str, $page_str);
}
else if ($numAccess != $numAlbums) {
$adminText .= sprintf(_("%s (%s), %s"), $toplevel_str, $total_str, $image_str);
} else if ($maxPages > 1) {
$adminText .= sprintf(_("%s, %s on %s"), $toplevel_str, $image_str, $page_str);
} else {
$adminText .= sprintf(_("%s, %s"), $toplevel_str, $image_str);
}
$adminText .= "</span>";
$adminCommands = "<span class=\"admin\">";

if ($gallery->user->isLoggedIn() && !$gallery->session->offline) {
$displayName = $gallery->user->getFullname();
if (empty($displayName)) {
$displayName = $gallery->user->getUsername();
}
$adminCommands .= sprintf(_("Welcome, %s"), $displayName) . "&amp;&amp;<br>";
}

if ($gallery->user->isAdmin()) {
$doc = galleryDocs();
if ($doc) {
$adminCommands .= "[$doc]&amp;";
}
}
if ($gallery->user->canCreateAlbums() && !$gallery->session->offline) {
$adminCommands .= "<a href=" . doCommand("new-album", array(), "view_album.php") . ">[". _("new album") ."]</a>&amp;";
}

if ($gallery->user->isAdmin()) {
if ($gallery->userDB->canModifyUser() ||
$gallery->userDB->canCreateUser() ||
$gallery->userDB->canDeleteUser()) {
$adminCommands .= popup_link("[" . _("manage users") ."]",
"manage_users.php");
}
}

if ($gallery->user->isLoggedIn() && !$gallery->session->offline) {
if ($gallery->userDB->canModifyUser()) {
$adminCommands .= popup_link("[". _("preferences") ."]",
"user_preferences.php");
}

if (!$GALLERY_EMBEDDED_INSIDE) {
$adminCommands .= "<a href=". doCommand("logout", array(), "albums.php"). ">[". _("logout") ."]</a>";
}
} else {
if (!$GALLERY_EMBEDDED_INSIDE) {
$adminCommands .= popup_link("[" . _("login") . "]", "login.php", 0);
// $adminCommands .= popup_link("[" . _("login") . "]", "login.php", 0, true, 250, 500);
}
}

$adminCommands .= "</span>";
$adminbox["text"] = $adminText;
$adminbox["commands"] = $adminCommands;
$adminbox["bordercolor"] = $borderColor;
$adminbox["top"] = true;
include ($GALLERY_BASEDIR . "layout/adminbox.inc");
?>

<!-- top nav -->
<?php
include($GALLERY_BASEDIR . "layout/navigator.inc");
include($GALLERY_BASEDIR . "layout/ml_pulldown.inc");
?>

<!-- album table begin -->
<table width=100% border=0 cellpadding=0 cellspacing=7>

<?php
/* Display warnings about broken albums */
if (sizeof($albumDB->brokenAlbums) && $gallery->user->isAdmin()) {
print "<tr>";
print "<td colspan=3 align=center>";
print "<table bordercolor=red border=2 cellpadding=2 cellspacing=2><tr><td>";
print "<center><b><u>". _("Attention Gallery Administrator!") ."</u></b></center><br>";
$broken_albums = '';
foreach ($albumDB->brokenAlbums as $tmpAlbumName) {
$broken_albums .= "$tmpAlbumName<br>";
}
print sprintf(_("%s has detected the following directories: %s in your albums directory (%s)."),
Gallery(),
"<br><br> <center>$broken_albums</center>",
$gallery->app->albumDir);
print "<br>";
print _("These are not valid albums. Please move them out of the albums directory.") ;
print "</td></tr></table>";
print "</td>";
print "</tr>";
}
?>

<?php
$start = ($gallery->session->albumListPage - 1) * $perPage + 1;
$end = min($start + $perPage - 1, $numAlbums);
for ($i = $start; $i <= $end; $i++) {
$gallery->album = $albumDB->getAlbum($gallery->user, $i);
$isRoot = $gallery->album->isRoot(); // Only display album if it is a root album
if($isRoot) {
if (strcmp($gallery->app->default["showOwners"], "no")) {
$owner = $gallery->album->getOwner();
}
$tmpAlbumName = $gallery->album->fields["name"];
$albumURL = makeAlbumUrl($tmpAlbumName);
?>

<!-- Begin Album Column Block -->
<tr>
<td height="1"><?php echo $pixelImage ?></td>
<td bgcolor="<?php echo $borderColor ?>" height="1"><?php echo $pixelImage ?></td>
<?php
if (!strcmp($gallery->app->showAlbumTree, "yes")) {
?>
<td bgcolor="<?php echo $borderColor ?>" height="1"><?php echo $pixelImage ?></td>

<?php
}
?>
</tr>
<tr>
<!-- Begin Image Cell -->
<td align="center" valign="middle">

<?php
$gallery->html_wrap['borderColor'] = $borderColor;
$gallery->html_wrap['borderWidth'] = 1;
$gallery->html_wrap['pixelImage'] = $imageDir . "/pixel_trans.gif";
$scaleTo = $gallery->app->highlight_size;
$highlightIndex = $gallery->album->getHighlight();
if (isset($highlightIndex)) {
list($iWidth, $iHeight) = $gallery->album->getThumbDimensions($highlightIndex, $scaleTo);
} else {
$iWidth = $gallery->app->highlight_size;
$iHeight = 100;
}
$gallery->html_wrap['thumbWidth'] = $iWidth;
$gallery->html_wrap['thumbHeight'] = $iHeight;
$gallery->html_wrap['thumbTag'] = $gallery->album->getHighlightTag($scaleTo);
$gallery->html_wrap['thumbHref'] = $albumURL;
includeHtmlWrap('inline_gallerythumb.frame');
?>
</td>
<!-- End Image Cell -->
<!-- Begin Text Cell -->
<td rowspan="2" align=<?php echo $gallery->alignment ?> valign=top>

</td>
<?php if (!strcmp($gallery->app->showAlbumTree, "yes")) { ?>
<td rowspan="2" valign=top>
<?php echo printChildren($albumName); ?>
</td>
<?php } ?>
</tr>
<tr>
<td align="center" valign="middle"> <span class="title">
<a href=<?php echo $albumURL ?>>
<?php _("title") ?>
<?php echo editField($gallery->album, "title") ?></a>
</span>
<br>
<span class="desc">
<?php _("description") ?>
<?php echo editField($gallery->album, "description") ?>
</span>
<br>
<?php if (strcmp($gallery->app->default["showOwners"], "no")) { ?>
<span class="desc">
<?php
echo _("Owner:") . " ";
if (!$owner->getEmail()) {
echo $owner->getFullName();
} else {
echo "<a href=\"mailto:" . $owner->getEmail() . "\">" . $owner->getFullName() . "</a>";
}
?>
</span>
<br>
<?php } ?>

<?php if ($gallery->user->canDeleteAlbum($gallery->album)) { ?>
<span class="admin">
<?php echo popup_link("[". _("delete album") ."]",
"delete_album.php?set_albumName={$tmpAlbumName}"); ?>
</span>
<?php } ?>

<?php if ($gallery->user->canWriteToAlbum($gallery->album)) { ?>
<span class="admin">
<?php echo popup_link("[". _("move album") ."]",
"move_album.php?set_albumName={$tmpAlbumName}&index=$i"); ?>
<?php echo popup_link("[" . _("rename album") ."]", "rename_album.php?set_albumName={$tmpAlbumName}&index=$i"); ?>
</span>
<?php } ?>

<?php if ($gallery->user->canChangeTextOfAlbum($gallery->album)
&& !$gallery->session->offline) { ?>
<span class="admin">
<a href=<?php echo makeGalleryUrl("captionator.php", array("set_albumName" => $tmpAlbumName)) ?>>[<?php echo _("edit captions") ?>]</a>
</span>
<?php } ?>

<?php if ($gallery->user->isAdmin() || $gallery->user->isOwnerOfAlbum($gallery->album)) { ?>
<span class="admin">
<?php echo popup_link("[" . _("permissions") ."]", "album_permissions.php?set_albumName={$tmpAlbumName}"); ?>
<?php if (!strcmp($gallery->album->fields["public_comments"],"yes")) { ?>
<a href=<?php echo makeGalleryUrl("view_comments.php", array("set_albumName" => $tmpAlbumName)) ?>>[<?php echo _("view&amp;comments") ?>]</a>
<?php } ?>
</span>
<br>
url: <a href=<?php echo $albumURL ?>>
<?php if (!$gallery->session->offline) {
echo breakString($albumURL, 60, '&', 5);
} else {
echo $tmpAlbumName;
}
?>
</a>
<?php if (ereg("album[[:digit:]]+$", $albumURL)) { ?>
<?php if (!$gallery->session->offline) { ?>
<br>
<span class="error">
<?php echo _("Hey!") ?>
<?php echo sprintf(_("%s this album so that the URL is not so generic!"),
popup_link(_("Rename"), "rename_album.php?set_albumName={$tmpAlbumName}&index=$i")) ?>
</span>
<?php } ?>
<?php } ?>
<?php if ($gallery->album->versionOutOfDate()) { ?>
<?php if ($gallery->user->isAdmin()) { ?>
<br>
<span class="error">
<?php echo _("Note: This album is out of date!") ?> <?php echo popup_link("[" . _("upgrade album") ."]", "upgrade_album.php") ?>
</span>
<?php } ?>
<?php } ?>
<?php } ?>

<br>
<span class="fineprint">
<?php echo sprintf(_("Last changed on %s."), $gallery->album->getLastModificationDate() )?>
<?php echo sprintf(_("This album contains %s." ), pluralize_n($gallery->album->numPhotos(0), _("item"), _("items"), _("no items")));
if (!($gallery->album->fields["display_clicks"] == "no") &&
!$gallery->session->offline) {
?>
<br><br><?php echo sprintf(_("This album has been viewed %s since %s."),
pluralize_n($gallery->album->getClicks(), _("time"), _("times") , _("0 times")),
$gallery->album->getClicksDate() );
}
$albumName=$gallery->album->fields["name"];
if ($gallery->user->canWriteToAlbum($gallery->album) &&
(!($gallery->album->fields["display_clicks"] == "no"))) {
?>
<?php echo popup_link("[" . _("reset counter") ."]", "'" . doCommand("reset-album-clicks", array("set_albumName" => $albumName), "albums.php") . "'" , 1) ?>

<?php
}
?>
</span></td>
</tr>
<!-- End Text Cell -->
<!-- End Album Column Block -->

<?php
} // if isRoot() close
} // for() loop
?>
</table>
<!-- album table end -->
<!-- bottom nav -->
<?php
include($GALLERY_BASEDIR . "layout/navigator.inc");
?>

<!-- gallery.footer begin -->
<?php

includeHtmlWrap("gallery.footer");
?>
<!-- gallery.footer end -->

<?php if (!$GALLERY_EMBEDDED_INSIDE) { ?>
</body>
</html>
<?php } ?>

 
chrispy

Joined: 2003-11-11
Posts: 14
Posted: Wed, 2003-11-12 08:01

nevermind... i figured it out... check out the gallery

 
Roo
Roo's picture

Joined: 2003-07-16
Posts: 88
Posted: Wed, 2003-11-12 09:24

What I did was to create my own index.html file and place it in the Gallery directory..
.had to edit .htaccess as well...there is a post here where someone told me what to do to htaccess.

I chose not to use the return to link because once inside I didn't want people going to albums.php....I want them going to my own page.

So when people enter my gallery this is the page they get:
http://www.sapphirestudios.net/gallery/

 
chrispy

Joined: 2003-11-11
Posts: 14
Posted: Thu, 2003-11-13 06:03

hi roo,

i managed to do it with the main gallery page. i just messed around with the view_album.php, and nested the Album Column block section within a table, and each instance of the block would use a td tag to create a new column inside the table. i've gone crazy looking at code for the past 3 days. now if i can only figure out that "Call to a member function on a non-object" error that i have.

-chrispy

 
jonesclan

Joined: 2003-11-11
Posts: 9
Posted: Thu, 2003-11-13 15:14

hi roo,
What did you have to do to the htaccess file? I can't even find mine on my site using cuteftp. In the setup, it says it has an empty htaccess file? Is there another one somewhere else? I know html fairly well, and edit java scripts, but this is the first time I've worked with php, so I'm a bit disoriented. Thanks in advance for any help you can provide. :D

 
h0bbel
h0bbel's picture

Joined: 2002-07-28
Posts: 13451
Posted: Thu, 2003-11-13 16:52

jonesclan, check FAQ Gallery:c.19