Fix for Issue 22 from HungryFeline.
This commit is contained in:
parent
864e823447
commit
2e276a095e
1 changed files with 1 additions and 0 deletions
|
@ -93,6 +93,7 @@ class Image {
|
|||
public static function by_random($tags=array()) {
|
||||
assert(is_array($tags));
|
||||
$max = Image::count_images($tags);
|
||||
if ($max < 1) return null; // From Issue #22 - opened by HungryFeline on May 30, 2011.
|
||||
$rand = mt_rand(0, $max-1);
|
||||
$set = Image::find_images($rand, 1, $tags);
|
||||
if(count($set) > 0) return $set[0];
|
||||
|
|
Reference in a new issue