I think that you are true anyway, getFirstImageURL() should work also with dynamic albums.
I possibly found a bug in getImage($index) function in album class-album.php:
return newImage($album, $images['filename']);
should be:
return newImage($album, $images[$index]['filename']);
If not I get an Undefined index notice when I call it from getFirstImageURL() while in dynamic album context.
Then the URL in getFirstImageURL() function should be modified for dynamic albums to have a link to the right static album containing the image.
May be I'm going beyond my knowlege and my possibilities, if so be patient with me please
I hope this helps, anyway my goal is far too hard for me.
What I'm tryng to do is to have a direct link to the first image of a dynamic album in my index page.
I was able to get the first image of a given dynamic album using the above fix and rewriting the URL in a custom function, stored in a plugin: getMyFirstImageURL().
But of course after that i fall in the static album's image page and i can't browse my dynamic album using the next button.
I found a very dirty way, but it means that it's possible somehow.
The image page with the first image of dynamic album is called from a link on index page, which also passes a variable, like: ?var=value1
When in image.php if $var="value1" it sets the proper cookie before any output but then for some reason it needs a refresh to the same page, set the cookie again and then it works. To get out of the refresh loop I make it change $var to "value2" in header("location: $mypage?var=value2")
Too bad to use it in a real site, but this suggest to me that the reason why it doesn't work the first time I call the image page may be a matter of context.
Any suggestion to clean this routine?
It didn't work, but made me found a solution.
I'll explain it here to share with other people and also to have your opinion about compatibility with future versions of zenphoto.
After setting the cookie I created $_zp_current_search = new SearchEngine() and stored the proper search parameters (as in the cookie) in $_zp_current_search.
Then I set the proper context, i.e. 167 or set_context(ZP_SEARCH_LINKED | ZP_IMAGE_LINKED | ZP_IMAGE | ZP_INDEX | ZP_ALBUM)