summaryrefslogtreecommitdiff
path: root/core/helpers
diff options
context:
space:
mode:
authorTim Almdal <tnalmdal@shaw.ca>2008-12-13 05:01:12 +0000
committerTim Almdal <tnalmdal@shaw.ca>2008-12-13 05:01:12 +0000
commit80792d4fb156e8c9a06760361bbb66b5a7c1db59 (patch)
tree4caaa4dddc62828ed8adc67282e4133bb5c42fae /core/helpers
parent7b7bf37e673d184556c114d6083b2d7699ab00d3 (diff)
Set the resize and thumbnail maximum dimension into the module vars table
Diffstat (limited to 'core/helpers')
-rw-r--r--core/helpers/core_installer.php8
-rw-r--r--core/helpers/photo.php8
2 files changed, 11 insertions, 5 deletions
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);