Hi,
Any time I try to use the printAlbumzip function on an album I get this error:
`Fatal error: Call to a member function getPersistentArchive() on a non-object in /home/content/65/8079365/html/zenphoto/zp-core/album-zip.php on line 66`
This is the code I've added into a codeblock to call the function:
`
<?php<br />
if (function_exists ('printAlbumZip')) { printAlbumZip();}
?>
`
I've enabled persistent archives in the options, not sure if that has helped as the same error is given either way.
Does this function work for others, or is this a wider problem not specific to me?
Thanks!
Comments
`<<br />
?php
if (function_exists ('printAlbumZip')) {
global $_zp_current_album;
printAlbumZip();}
?>
`
Unfortunately I still get the same error.
Do some debug output--see what the value of $_zp_current_album is before your call.
Echoing $_zp_current_album->getTitle () gives me the correct title of the album, so it looks like it is picking the right album object.
Just for info I echoed $_zp_gallery->getTitle () but that just returned an empty result.
So next I added these lines to album-zip.php just before the line that was giving me a problem:
` echo '
';
echo 'gallery= '.$_zp_gallery->getTitle();
echo 'album= '.$_zp_current_album->getTitle ();
`
Now I get the 'Call to a member function getTitle() on a non-object' error on that second echo (the $_zp_gallery one), so it looks like it's losing the context somewhere maybe? I'm not great on classes and objects, so this is guesswork for me.
If I manually change the url in the browser window to use the correct case for the album title (i.e. with a capital R, as in album-zip.php?album=Randoms) I do not get the 'non-object' error - I still don't get a zip file but that's another problem.
How can I ensure that the printAlbumzip function passes the correct album name with the correct case?
`echo'getTitle()) .
'" title="'.gettext('Download Zip of the Album').'">'.gettext('Download a zip file of this album').'';`
Previously it used $_zp_current_album->name in the pathurlencode function. After this change it passes the correct album title and I don't get the non-object error. I am still looking into why I don't get a zip file output.
So, next I tried commenting out line 66 of print-album.zip ($persist = $_zp_gallery->getPersistentArchive();) and adding $persist = NULL; instead. This works in the sense that the zip file is created, but presumably there's no caching going on, so every request will create a new file.