What's this block-random.php? Hints please :-)

zman
zman's picture

Joined: 2003-07-24
Posts: 196
Posted: Thu, 2005-07-14 20:38

Hey Guys/Gals!

I have a heavily modified version of Gallery from about a year ago. I STILL have not put this site online to replace my other one because of a few bugs I'm trying to work out and no time to do so. :(

One thing I have noticed is there are some pretty cool new features in the newer versions of Gallery 1. I would like to update to the new version but I've got so many "hacks" that I've done that I'm a bit reluctant to try all these again.

One major hack that I did was to put 2 random pics from my gallery on EVERY page no matter where people click in my Gallery. This is done NOT with any Gallery code but rather what I do is when a picture is uploaded I write this information to a .txt file and then this file is read each time a page is viewed. Works darn good with what I have now except the problem is that when a picture is deleted from the gallery or moved, my txt file is obviously not updated with this information so I end up having broken links. The other issue, while I've not run into it yet, is that I'm sure performance will be degraded as the gallery gets larger due to having to read this txt file each time. Since I'm just a hack and don't know actual programming, I didn't cache anything or anything like that :)

At any rate, I do still visit here every so often and have noticed mention of a block-random.php file that somebody mentioned can be used in an php include statement to put a random picture from your gallery anywhere on the page of your site.

I do not have the newest version of gallery installed and therefore am not familiar with this new feature. What I'm wondering is if one of you modder guys familiar with this new feature could give me a quick yes/no as to if this mod can replace my current random picture mod. To see what I'm doing now, please take a look here...

http://www.extreme-z.com/appearance/gallery/albums.php

Notice in the upper right I have a "Random Camaro Photo" and a "Random Firebird Photo". No matter where you go in my gallery, these pictures are still visible. Can this block-random.php replace this mod of mine and function in a similar fashion? That would be GREAT if it can!!!

In case you are wondering how I'm pulling out specific pics from specific albums, all my Camaro albums start with "c" and all my firebird albums start with "f" so my script, depending on the first character, saves to either my camaro.txt file or my firebird.txt file. I'll need to figure out how to do something similar later with the block-random.php thing but for now, just wondering if I can get similar results with this included feature?

Any insight would be appreciated. Thanks!!!

 
fryfrog

Joined: 2002-10-30
Posts: 3236
Posted: Fri, 2005-07-15 04:10

You might poke around for block-random-enhanced.php which I believe will take a sub-album as a parameter. So if you have two main albums called "Camaro" and "Firebird" you can just pass it an option like ?from_album=Camaro and ?from_album=Firebird. Of course, the syntax may be different cause I am just makin stuff up as I go.

So, yes block-random-enhanced.php should work fine for you. And block-random.php may actually do it to, just open it up and read the source luke :)

 
floridave
floridave's picture

Joined: 2003-12-22
Posts: 27300
Posted: Fri, 2005-07-15 04:18

as fryfrog said:
http://www.barcahall.com/gallery-block-random.html

moving to correct forum.

 
zman
zman's picture

Joined: 2003-07-24
Posts: 196
Posted: Fri, 2005-07-15 10:25

Sorry about that floridave. I was thinking along the lines of modding so didn't stick it in this forum :)

I'll take a look but I think this will work! :D