I have a problem with this gallery:
http://www.athelstonesc.com/galleryIt was working fine and it seems without changing anything something has broken it. I have since reinstalled the gallery without a change in what is happening.
The images / database are fine and the gallery index appears fine, however clicking on the individual galleries gives a blank page.
I am still able to edit the albums and upload images in admin without a problem. From the admin area i can access individual photo pages which also work fine, it's just the album index page which is not working
I have tried changing mod_rewrite without success.
I am now stumped as to the cause of this. Can you help?
Comments
`
` call, which is the strangest thing... Let's look at all code that's called with that one call, shall we? I'm going to nail this bugger once and for all....
So, let's backtrace.
album.php:16 `getGalleryIndexURL();`
> template-functions.php:77
`function getGalleryIndexURL() {
global $_zp_current_album;
if (in_context(ZP_ALBUM) && $_zp_current_album->getGalleryPage() > 1) {
$page = $_zp_current_album->getGalleryPage();
return rewrite_path("/page/" . $page, "/index.php?page=" . $page);
} else {
return WEBPATH . "/";
}
}`
> class-album.php:279
`function getGalleryPage() {
$albums_per_page = zp_conf('albums_per_page');
if ($this->index == null)
$this->index = array_search($this->name, $this->gallery->getAlbums(0));
return floor(($this->index / $albums_per_page)+1);
}`
> class-gallery:36
` function getAlbums($page=0) {
// Have the albums been loaded yet?
if (is_null($this->albums)) {
$albumnames = $this->loadAlbumNames();
$albums = $this->sortAlbumArray($albumnames);
$this->albums = $albums;
}
if ($page == 0) {
return $this->albums;
} else {
$albums_per_page = zp_conf('albums_per_page');
return array_slice($this->albums, $albums_per_page*($page-1), $albums_per_page);
}
}`
> class-gallery.php:107
` function loadAlbumNames() {
$albumdir = $this->getAlbumDir();
if (!is_dir($albumdir) || !is_readable($albumdir)) {
die("Error: The 'albums' directory cannot be found or is not readable.");
}
$dir = opendir($albumdir);
$albums = array();
while ($dirname = readdir($dir)) {
if (is_dir($albumdir.$dirname) && substr($dirname, 0, 1) != '.') {
$albums[] = $dirname;
}
}
closedir($dir);
return $albums;
}`
> class-gallery.php:67
` function sortAlbumArray($albums) {
$albums_r = array();
$result = query("SELECT folder, sort_order FROM " . prefix("albums")
. " ORDER BY sort_order");
$i = 0;
$albums_r = array_flip($albums);
$albums_touched = array();
while ($row = mysql_fetch_assoc($result)) {
$folder = $row['folder'];
if (array_key_exists($folder, $albums_r)) {
$albums_r[$folder] = $i;
$albums_touched[] = $folder;
}
$i++;
}
$albums_untouched = array_diff($albums, $albums_touched);
foreach($albums_untouched as $alb) {
$albums_r[$alb] = $i;
$i++;
}
$albums = array_flip($albums_r);
ksort($albums);
$albums_ordered = array();
foreach($albums as $album) {
$albums_ordered[] = $album;
}
return $albums_ordered;
}`
Whew. That's all the meaningful code that gets executed with that one call... crazy. I'm posting this, then I'm going to look through it for possible problems.
Has a fix for this been found yet?
I haven't looked at the code yet, but I'll post back if I get it fixed here.
Also, what is being used to make the thumbnails? Mine aren't bein displayed at all... not sure if the module is installed/enabled server side.
Thanks