support for picking n'th item from the consistent hash
This commit is contained in:
parent
97a03d8f83
commit
840915c9f0
1 changed files with 3 additions and 2 deletions
|
@ -686,7 +686,7 @@ class Image {
|
||||||
* @param string $_escape
|
* @param string $_escape
|
||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
public function parse_link_template($tmpl, $_escape="url_escape") {
|
public function parse_link_template($tmpl, $_escape="url_escape", $n=0) {
|
||||||
global $config;
|
global $config;
|
||||||
|
|
||||||
// don't bother hitting the database if it won't be used...
|
// don't bother hitting the database if it won't be used...
|
||||||
|
@ -750,7 +750,8 @@ class Image {
|
||||||
}
|
}
|
||||||
|
|
||||||
// $choice = $flexihash->lookup($pre.$post);
|
// $choice = $flexihash->lookup($pre.$post);
|
||||||
$choice = $flexihash->lookup($this->hash); // doesn't change
|
$choices = $flexihash->lookupList($this->hash, $n+1); // hash doesn't change
|
||||||
|
$choice = $choices[$n];
|
||||||
$tmpl = $pre.$choice.$post;
|
$tmpl = $pre.$choice.$post;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Reference in a new issue