Image::by_random fix from artanis
git-svn-id: file:///home/shish/svn/shimmie2/trunk@1106 7f39781d-f577-437e-ae19-be835c7a54ca
This commit is contained in:
parent
26e3fb8e34
commit
24461ad4ca
@ -48,7 +48,7 @@ class Image {
|
|||||||
|
|
||||||
public static function by_random(Config $config, Database $database, $tags=array()) {
|
public static function by_random(Config $config, Database $database, $tags=array()) {
|
||||||
$max = Image::count_images($config, $database, $tags);
|
$max = Image::count_images($config, $database, $tags);
|
||||||
$rand = mt_rand(0, $max);
|
$rand = mt_rand(0, $max-1);
|
||||||
$set = Image::find_images($config, $database, $rand, 1, $tags);
|
$set = Image::find_images($config, $database, $rand, 1, $tags);
|
||||||
if(count($set) > 0) return $set[0];
|
if(count($set) > 0) return $set[0];
|
||||||
else return null;
|
else return null;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user