mirror of
https://github.com/Pathduck/gallery3.git
synced 2026-08-15 11:27:24 -04:00
Add random_photo()
This commit is contained in:
@@ -28,4 +28,15 @@ class test_Core {
|
||||
$album->title = "title_$rand";
|
||||
return $album->save();
|
||||
}
|
||||
|
||||
static function random_photo($parent=null) {
|
||||
$rand = rand();
|
||||
$photo = ORM::factory("item");
|
||||
$photo->type = "photo";
|
||||
$photo->parent_id = $parent ? $parent->id : 1;
|
||||
$photo->set_data_file(MODPATH . "gallery/tests/test.jpg");
|
||||
$photo->name = "name_$rand.jpg";
|
||||
$photo->title = "title_$rand";
|
||||
return $photo->save();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user