Choose Picture from a particular Sub-album?

AlpineZone
AlpineZone's picture

Joined: 2004-01-21
Posts: 69
Posted: Thu, 2004-07-15 18:05

My main Gallery is broken up into two sub-albums. I would like to create three Random Block scripts where (1) one would display pictures from all albums (2) one would display pictures from one of the sub-albums only, and (3) one would display pictures from the other sub-album only. I tried the suggestion in this thread, but it didn't work. Any thoughts?

 
AlpineZone
AlpineZone's picture

Joined: 2004-01-21
Posts: 69
Posted: Sun, 2004-07-18 12:18

BTW, I'm using Gallery 1.4.4-RC1, embedded in phpBB 2.0.8 and the random block that is packaged with 1.4.4-RC1, i.e. the block-random.php file. Thanks.

 
jeffbh

Joined: 2002-12-26
Posts: 38
Posted: Tue, 2004-07-20 07:29

Hi AlpineZone,

You can do this easily, if you are comfortable modifying block-random.php to accept an "album" parameter. Here's how I did it. This works in a standalone environment--where Gallery is not embedded in a CMS/portal such as php-nuke, mambo, or geeklog--because you can easily add a parameter to the URL with which you invoke block-random.php.

You'll be modifying Gallery code, so make a backup copy of the file first. Then:

Replace line 66 in the 1.4.4-RC1 version of block-random.php:
$album = chooseAlbum();
with the following:

if (!empty($HTTP_GET_VARS["album"])) 
    { 
    $album = new Album(); 
    $album->load($HTTP_GET_VARS["album"]); 
    } 
else 
    $album = chooseAlbum(); 

After making that change, to only display random photos from, say, your NYtrip album, append "?album=NYtrip" to the URL you use to call block-random.php.

Hope this helps.
-Jeff

 
AlpineZone
AlpineZone's picture

Joined: 2004-01-21
Posts: 69
Posted: Tue, 2004-07-20 13:01

Hi Jeff - your solution (sort of) works. However, I need to specify a particular album of sub-albums to pull images from. Your solution pulls the sub-album highlight photos only which causes a different issue as discussed here. I need to be able to specify which "parent" album (doesn't contain images) to pull from, and then display images from that album's sub-albums. I hope that makes sense. Any thoughts?

 
jeffbh

Joined: 2002-12-26
Posts: 38
Posted: Wed, 2004-07-21 08:12

AlpineZone,

What you're describing (recursing into sub-albums) is precisely the behavior of my pre-1.4.4RC1, highly modified version of block-random:barcahall.com/gallery-block-random.html.

I am hoping to "retire" my version and offer any desirable enhancements for inclusion in the official codebase, now that block-random.php is in the Gallery distribution. But that requires some re-work of the code to make it release-quality, including a move away from querystring parameters to proper Gallery configuration options (such as was done recently for random block cache time) before the dev team will even consider integrating such changes.

In the meantime, I intend to integrate my changes with the 1.4.4-RC1 block-random.php and offer that as the next version on my site. Don't know when I'll get the chance to do that, though. It will be on my page when I do.

-Jeff

 
AlpineZone
AlpineZone's picture

Joined: 2004-01-21
Posts: 69
Posted: Wed, 2004-07-21 12:37

So...does your custom block-random.php work with 1.4.4-RC1 or RC2?

 
jeffbh

Joined: 2002-12-26
Posts: 38
Posted: Wed, 2004-07-28 08:21
AlpineZone wrote:
So...does your custom block-random.php work with 1.4.4-RC1 or RC2?

I have integrated my changes into the 1.4.4-RC2 block-random.php and intend to keep up-to-date with future Gallery 1 versions. To avoid a filename conflict, I have renamed my version block-random-enhanced.php; you can find it at barcahall.com/gallery-block-random.html.

-Jeff

 
AlpineZone
AlpineZone's picture

Joined: 2004-01-21
Posts: 69
Posted: Wed, 2004-08-11 14:40

I hopeful that someone will take the time to hack up the current default block-random.php file to allow specification from particular sub-albums. No offense jeffbh, but I'm very happy with the way the current 1.4.4 block-random.php works and am reluctant to change it now. This feature (along with displaying the default photo-frame) are the only other features I'd like.

 
AlpineZone
AlpineZone's picture

Joined: 2004-01-21
Posts: 69
Posted: Tue, 2004-09-21 14:17
AlpineZone wrote:
I hopeful that someone will take the time to hack up the current default block-random.php file to allow specification from particular sub-albums. No offense jeffbh, but I'm very happy with the way the current 1.4.4 block-random.php works and am reluctant to change it now. This feature (along with displaying the default photo-frame) are the only other features I'd like.

Has anyone undertaken this?

 
jeffbh

Joined: 2002-12-26
Posts: 38
Posted: Fri, 2004-09-24 20:14
AlpineZone wrote:
AlpineZone wrote:
I hopeful that someone will take the time to hack up the current default block-random.php file to allow specification from particular sub-albums. No offense jeffbh, but I'm very happy with the way the current 1.4.4 block-random.php works and am reluctant to change it now. This feature (along with displaying the default photo-frame) are the only other features I'd like.

Has anyone undertaken this?

No offense taken, but I must not be understanding something here. What you're asking for sounds like what I've already made available (other than the name being different for clarification, and the lack of photo-frame display).

Block-random-enhanced.php works, by default, just like block-random.php (not surprising, since it's just a derivative). Only if you feed it optional arguments does it behave differently to support its enhancements. (Incidentally, it is my use of querystring parameters to pass in those arguments that keeps my changes from being considered as patch submissions back to the default block-random.php in the Gallery 1.x codebase; that technique is incompatible with the goal of having all configuration done through the standard Gallery setup UI.)

-Jeff

 
AlpineZone
AlpineZone's picture

Joined: 2004-01-21
Posts: 69
Posted: Thu, 2004-09-30 14:12

Hi Jeff. I did implement your enhanced block random and it seems to be working well pulling from subalbums. Thanks!

 
copyman1

Joined: 2004-02-27
Posts: 9
Posted: Sun, 2004-10-17 20:36

Hi, I'm using Gallery 1.4.4-pl2, embedded in PostNuke. I have sub-almus and "sub-sub-albums with more than 1500 fotos. Main
album which only contain sub-albums, not pictures. I need to specify a particular album of sub-albums to pull images from.
Installed block with:
*********************************************************************************
if (pnModAvailable('your-gallery-name'))
include("http://your.server/modules.php?op=modload&name=your-gallery-name&file=index&include=block-random.php");
else
echo ' ';
*********************************************************************************

The block is blank only displays block title.

any idea?
Thanks

Milen