Howdy,
first, I have to say that this block is really great. I got it working with no trouble (postnuke .723 and gallery 1.3.4).
Second, I'm wondering if I missed something in the installation because only the albums that existed when the block was installed are being selected from form the random front page image. How do I make sure that new albums/photos get used in the random block?
thanks!
craig
Posts: 3474
The random block data is updated once every 24 hours.
The data is stored in a cache file.
All you need to do is remove that file.
To do that, write a short PHP script and run it in your browser. Put this inside:
Now, the cache file will be regenerated and should include recently added photos.
-Beckett (
)
Posts: 18
Thanks Beckett. I knew I must be missing something. If that isn't in the docs for the block than it should be. Maybe something like that could be added as a feature: flush cache or something...
Thanks again!
Posts: 18
Hey Beckett (or anyone else),
Can you tell me a little more about the caching mechanism? Does it just grab a certain number of pics from those available, or does it use ALL of them? If just a certain number, how many? is that configurable? How is the randomizing done?
thanks!
Posts: 3474
Right now the random block, when writing to the cache, polls each album and finds out how many images are visible to the public. It stores each album name, followed by that number, into a cache file.
Now, when the block runs by reading from the cache, it adds up all the numbers to weight each photo equally, and selects one at random (Just using very very rough rand(), seeded with the CPU clock).
Right now, the random block is really not configurable at all (unless you modify the code, which you're welcome to do). We're hoping to add some more features in the future, such as an ability to include/exclude specific albums in the rotation, as well as having current updates to the cache (right now, if you add/delete/move photos or rename an album, the random block will have unpredictable behaviour, and possibly will generate errors, until the cache is updated again.
-Beckett (
)
Posts: 25
yeah, he is right, some photos are not used in the block at all
i am using gallery 1.3.4 & phpnuke 6.7 and i finally got the random block working after changing
$choose = rand($count)
to
$choose = rand(1, (int) $count);
so it only takes the photos from the first album and thats it, i checked out the cache file, and all the albums are in there, but the bug is "getting th epic randomly"
i am guessing that
$choose = rand(1, (int) $count);
this needs a touch or something.any sugestions?