Hi, after I upgraded to 1.4.2.3 (latest attempt was with latest nightly),
instead the gallery's main page I see error message
Fatal error: Call to a member function getNumImages() on a non-object in ..../zp-core/template-functions.php on line 1654
I can see and navigate inside albums by pointing directly to their address. But link to the main page on the top gives weird url - instead the proper gallery url there is additional /page/2/ at the end (
http://my.gallery.url/page/2/).
Downgrading to 1.4.2.2 solved the issue for this time.
Comments
Commented out 3 lines from template-functions.php
1624 - if (getNumImages()) {
1629 - }
1630 - return false;
The /page/2/ seems to be normal as albums in gallery index are on 2 pages.
Again I had to comment out these three lines in template-functions.php
Are you really sure that these lines are necessary? Without them my site works normally, no side effects.
function isImagePage() {
// if (getNumImages()) { //Jaanus commented out
global $_zp_page, $_firstPageImages;
$imagestart = getTotalPages(2); // # of album pages
if (!$_firstPageImages) $imagestart++; // then images start on the last album page.
return $_zp_page >= $imagestart;
//} Jaanus commented out
//return false; //Jaanus commented out
}
Is it needed for other templates?
Where (in which file) to look for the bug?
May it be because php version is earlier than 5.3 (5.2.17) ?
Etc etc etc
So I'm confused. Where could be the "place not setup for it"?
I'm pretty sure it should be somewhere else than theme files - as in my gallery page I got the same error with original "default" template where I hadn't changed anything.
Could some 3rd party plugin generate such error?
It was zenFBcommon.php (from the Facebook plugin). I don't know why but error generating code was on line 84:
if (isImagePage()) {
echo '<meta property="og:image" content="http://' . $_SERVER['HTTP_HOST'] . getUnprotectedImageURL() . '" />';
}
Perhaps you don't want to know how I solved it
At least temporarily it says now that "if this is not an album page":
if (!isAlbumPage()) {
echo '<meta property="og:image" content="http://' . $_SERVER['HTTP_HOST'] . getUnprotectedImageURL() . '" />';
}
Tested. It works. Picture is normally posted to my FB wall.
Sorry for this panic
Up until now this is the first I've heard of that being incorrect or having any errors. Did something change in the usage of this function?
Edit:
As a clarification, I understood the documentation to mean that it will return true if there's an image thumbnail on the page, no matter what page is loaded. For instance, a news page that has an image on that, for a FB link the user would most likely want to use one of the thumbnails from the news page and not their general image.
There is no way to check if there is any thumb in general on a page and specifically not on a news or pages page.
Your only chance is to check for the actual theme page.
I just used some (perhaps not much but still) older version that caused my problem. So I tried to fix the older, not the most actual version :S
and as I saw there is not isImagePage() at all.