Fix for Issue 22 from HungryFeline.

This commit is contained in:
green-ponies (jgen) 2011-09-11 21:41:46 -04:00
parent 864e823447
commit 2e276a095e

View file

@ -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];