summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--core/controllers/welcome.php3
-rw-r--r--core/helpers/core_installer.php8
-rw-r--r--core/helpers/photo.php8
-rw-r--r--core/tests/Var_Test.php7
4 files changed, 18 insertions, 8 deletions
diff --git a/core/controllers/welcome.php b/core/controllers/welcome.php
index 575156e5..cff39fd1 100644
--- a/core/controllers/welcome.php
+++ b/core/controllers/welcome.php
@@ -206,9 +206,10 @@ class Welcome_Controller extends Template_Controller {
$type = rand(0, 10) ? "photo" : "album";
}
if ($type == "album") {
+ $thumbnail_size = module::get_var("core", "thumbnail_size");
$parents[] = album::create(
$parent->id, "rnd_" . rand(), "Rnd $i", "random album $i", $owner_id)
- ->set_thumbnail(DOCROOT . "core/tests/test.jpg", 200, 150)
+ ->set_thumbnail(DOCROOT . "core/tests/test.jpg", $thumbnail_size, $thumbnail_size)
->save();
} else {
$photo_index = rand(0, count($test_images) - 1);
diff --git a/core/helpers/core_installer.php b/core/helpers/core_installer.php
index 27f8782e..b5b7adb5 100644
--- a/core/helpers/core_installer.php
+++ b/core/helpers/core_installer.php
@@ -106,15 +106,19 @@ class core_installer {
$root->right = 2;
$root->parent_id = 0;
$root->level = 1;
- $root->set_thumbnail(DOCROOT . "core/tests/test.jpg", 200, 150)
+ $root->set_thumbnail(DOCROOT . "core/tests/test.jpg", 200, 200)
->save();
access::add_item($root);
+ // Save this before setting vars so that module id is set
+ module::set_version("core", 1);
+
module::set_var("core", "active_theme", "default");
module::set_var("core", "active_admin_theme", "default_admin");
module::set_var("core", "page_size", 9);
+ module::set_var("core", "thumbnail_size", 200);
+ module::set_var("core", "resize_size", 640);
- module::set_version("core", 1);
}
}
diff --git a/core/helpers/photo.php b/core/helpers/photo.php
index 8f204714..2edd8a4f 100644
--- a/core/helpers/photo.php
+++ b/core/helpers/photo.php
@@ -77,10 +77,12 @@ class photo_Core {
$photo->add_to_parent($parent);
copy($filename, $photo->file_path());
- // @todo: parameterize these dimensions
// This saves the photo a second time, which is unfortunate but difficult to avoid.
- $result = $photo->set_thumbnail($filename, 200, 200)
- ->set_resize($filename, 640, 640)
+ $thumbnail_size = module::get_var("core", "thumbnail_size");
+ $resize_size = module::get_var("core", "resize_size");
+
+ $result = $photo->set_thumbnail($filename, $thumbnail_size, $thumbnail_size)
+ ->set_resize($filename, $resize_size, $resize_size)
->save();
module::event("photo_created", $photo);
diff --git a/core/tests/Var_Test.php b/core/tests/Var_Test.php
index bd4e360b..272a39fa 100644
--- a/core/tests/Var_Test.php
+++ b/core/tests/Var_Test.php
@@ -28,7 +28,10 @@ class Var_Test extends Unit_Test_Case {
module::set_var("core", "Parameter2", "new parameter");
$core = module::get("core");
- $expected = array("Parameter" => "updated value", "Parameter2" => "new parameter");
- $this->assert_equal($expected, $core->vars->select_list("name", "value"));
+ $params = $core->vars->select_list("name", "value");
+ $this->assert_false(empty($params["Parameter"]));
+ $this->assert_equal("updated value", $params["Parameter"]);
+ $this->assert_false(empty($params["Parameter2"]));
+ $this->assert_equal("new parameter", $params["Parameter2"]);
}
} \ No newline at end of file