Random photo -- Showing hidden album photos?

vivitron

Joined: 2002-12-09
Posts: 2
Posted: Mon, 2002-12-09 05:02

Hello,

I have tried several versions of the random block image and all of them show photos from nested albums I have hidden. I have tried modifying the code without success. Any suggestions or am I doing something wrong?

Thanks,
Dustin

 
Gaile

Joined: 2002-07-20
Posts: 1301
Posted: Mon, 2002-12-09 20:01

Hi

Are you using the random photo block as a standalone or one of the versions for phpnuke? I tried using a standalone version, and while it's not showing my hidden pics, it IS choking on sub-albums. The pattern has been so random that it's hard for me to see where the error lies.

I'm in the process of revamping my entire site and adding the newest version of Gallery (cvs), and will see if the random block code works any better for me then.

I don't know if you'll have any better luck with an answer if you post your question in the random block area or not. As well, you might want to post what changes you tried, or try searching within the threads here - people have tried a few different things, one might be the fix for you.

Good luck and Seasons Greetings from

Gaile

 
vivitron

Joined: 2002-12-09
Posts: 2
Posted: Tue, 2002-12-10 02:45

Hello,

I am using it as standalone.

I have spent many hours on studying the code and have some ideas. I've examined Gallery's album display to see how it checks to see if nested albums are hidden or not and have used the same code (with modified indexes, etc) in the random block...no luck..and here is what I think it causing this:

If I understand the coding correctly, it first gets a list of ROOT albums, scanning them to ensure that there are visible photos after hidden photos are subtracted. Then it chooses an album to pull the picture from..then it chooses a semi-random photo. I believe that the issue is that it is treating a nested album as a regular photo which results in the nested album object being hidden, while the photos inside of it are not... I could be on the wrong road here...

When I examine view_album.php, I see that nested albums are regular objects until they are checked later at this point while it is printing the photo grid
<!-- BBCode Start --><TABLE BORDER=0 ALIGN=CENTER WIDTH=85%><TR><TD><font class="pn-sub">Code:</font><HR></TD></TR><TR><TD><FONT class="pn-sub"><PRE> } elseif ($gallery->album->isAlbumName($i)) {
$myAlbumName = $gallery->album->isAlbumName($i);
$myAlbum = new Album();
$myAlbum->load($myAlbumName);
$gallery->html_wrap['thumbTag'] = $myAlbum->getHighlightAsThumbnailTag($scaleTo);
$gallery->html_wrap['thumbHref'] = makeAlbumUrl($myAlbumName);
includeHtmlWrap('inline_albumthumb.frame');

} else {</TD></TR></TABLE><!-- BBCode End -->
I may be wrong, but I guess the question in my mind is, how are nested album photos treated in regard to the root album? Are they visiible as objects in the root album?

Also, there are several 'hidden' photo/album checks in the random photo code, one is below in the choosePhoto routine:

<!-- BBCode Start --><TABLE BORDER=0 ALIGN=CENTER WIDTH=85%><TR><TD><font class="pn-sub">Code:</font><HR></TD></TR><TR><TD><FONT class="pn-sub"><PRE> if ($album->isHidden($choose)) {
$choose++;
if ($choose > $album->numPhotos(0)) {
$choose = 1;
$wrap++;

if ($wrap = 2) {
return null;
}
} </TD></TR></TABLE><!-- BBCode End -->

This again makes me wonder if all photos, including nested album photos, are considered objects when scanning the album? I could be wrong, but there are hidden album checked throughout the code in all routines that should rule out this from happenning.

Like I said, I could be on the wrong path, and if I am, I apologize, but this just seems to be the problem in this case, although I cannot prove it yet.

Any suggestions/help are great!
Thank you everyone!

Sincerely,
Dustin