diff options
author | Tim Almdal <tnalmdal@shaw.ca> | 2008-12-12 07:40:53 +0000 |
---|---|---|
committer | Tim Almdal <tnalmdal@shaw.ca> | 2008-12-12 07:40:53 +0000 |
commit | 2fb94444d963a288bcb4f0a9bf9a8cffdc9e9e04 (patch) | |
tree | a22724057c90fbd181a2b6b3deb9d7bee3d2b628 | |
parent | e65f8d50226ba13e01f3c3463ff67aeccac2b83a (diff) |
Randomly choose images from core/tests/images as test images
-rw-r--r-- | core/controllers/welcome.php | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/core/controllers/welcome.php b/core/controllers/welcome.php index b5215a02..9363a276 100644 --- a/core/controllers/welcome.php +++ b/core/controllers/welcome.php @@ -199,6 +199,8 @@ class Welcome_Controller extends Template_Controller { $parents = ORM::factory("item")->where("type", "album")->find_all()->as_array(); $owner_id = user::active()->id; + $test_images = glob(APPPATH . "tests/images/*.[Jj][Pp][Gg]"); + for ($i = 0; $i < $count; $i++) { set_time_limit(30); @@ -213,8 +215,9 @@ class Welcome_Controller extends Template_Controller { ->set_thumbnail(DOCROOT . "core/tests/test.jpg", 200, 150) ->save(); } else { - photo::create($parent->id, DOCROOT . "themes/default/images/thumbnail.jpg", - "thumbnail.jpg", "rnd_" . rand(), "sample thumbnail", $owner_id); + $photo_index = rand(0, count($test_images) - 1); + photo::create($parent->id, $test_images[$photo_index], basename($test_images[$photo_index]), + "rnd_" . rand(), "sample thumbnail", $owner_id); } } url::redirect("welcome"); |