summaryrefslogtreecommitdiff
path: root/core/helpers
diff options
context:
space:
mode:
authorBharat Mediratta <bharat@menalto.com>2008-12-17 04:45:35 +0000
committerBharat Mediratta <bharat@menalto.com>2008-12-17 04:45:35 +0000
commitfc7b78492bc671f6dd78e04f5d42de958cdfb1d7 (patch)
tree9ee1738b0869cd183f688180eedc144bb4fa385a /core/helpers
parentf8a0c91ce689c5e0ae7bf05cc75b9982a3b26baf (diff)
Separate thumbnails out into var/thumbs. This clears up some ambiguity in Item_Model and simplifies
file_proxy. It also means we can stop munging file names in the var/resizes hierarchy. In the process, rename "thumbnail" to "thumb" everywhere in honor of Chad (well, ok because it's shorter)..
Diffstat (limited to 'core/helpers')
-rw-r--r--core/helpers/access.php4
-rw-r--r--core/helpers/album.php6
-rw-r--r--core/helpers/core_installer.php18
-rw-r--r--core/helpers/photo.php4
4 files changed, 15 insertions, 17 deletions
diff --git a/core/helpers/access.php b/core/helpers/access.php
index b8aee683..05799bf5 100644
--- a/core/helpers/access.php
+++ b/core/helpers/access.php
@@ -467,7 +467,9 @@ class access_Core {
* Create .htaccess files to prevent direct access to the given album and its hierarchy.
*/
private static function _create_htaccess_files($album) {
- foreach (array($album->file_path(), dirname($album->resize_path())) as $dir) {
+ foreach (array($album->file_path(),
+ dirname($album->resize_path()),
+ dirname($album->thumb_path())) as $dir) {
$base_url = url::site("file_proxy");
$fp = fopen("$dir/.htaccess", "w+");
fwrite($fp, "<IfModule mod_rewrite.c>\n");
diff --git a/core/helpers/album.php b/core/helpers/album.php
index 9373c5d5..faf0fd98 100644
--- a/core/helpers/album.php
+++ b/core/helpers/album.php
@@ -54,10 +54,8 @@ class album_Core {
$album = $album->add_to_parent($parent);
mkdir($album->file_path());
- $thumbnail_dir = dirname($album->thumbnail_path());
- if (!file_exists($thumbnail_dir)) {
- mkdir($thumbnail_dir);
- }
+ mkdir(dirname($album->thumb_path()));
+ mkdir(dirname($album->resize_path()));
module::event("album_created", $album);
diff --git a/core/helpers/core_installer.php b/core/helpers/core_installer.php
index 1c5f92ea..de4c51d9 100644
--- a/core/helpers/core_installer.php
+++ b/core/helpers/core_installer.php
@@ -56,8 +56,8 @@ class core_installer {
`resize_height` int(9) default NULL,
`resize_width` int(9) default NULL,
`right` int(9) NOT NULL,
- `thumbnail_height` int(9) default NULL,
- `thumbnail_width` int(9) default NULL,
+ `thumb_height` int(9) default NULL,
+ `thumb_width` int(9) default NULL,
`title` char(255) default NULL,
`type` char(32) NOT NULL,
`width` int(9) default NULL,
@@ -91,7 +91,7 @@ class core_installer {
UNIQUE KEY(`module_id`, `name`))
ENGINE=InnoDB DEFAULT CHARSET=utf8;");
- foreach (array("albums", "resizes") as $dir) {
+ foreach (array("albums", "resizes", "thumbs", "uploads") as $dir) {
@mkdir(VARPATH . $dir);
}
@@ -106,8 +106,8 @@ class core_installer {
$root->right = 2;
$root->parent_id = 0;
$root->level = 1;
- $root->set_thumbnail(DOCROOT . "core/tests/test.jpg", 200, 200)
- ->save();
+ $root->set_thumb(DOCROOT . "core/tests/test.jpg", 200, 200);
+ $root->save();
access::add_item($root);
// Save this before setting vars so that module id is set
@@ -116,9 +116,8 @@ class core_installer {
module::set_var("core", "active_theme", "default");
module::set_var("core", "active_admin_theme", "admin_default");
module::set_var("core", "page_size", 9);
- module::set_var("core", "thumbnail_size", 200);
+ module::set_var("core", "thumb_size", 200);
module::set_var("core", "resize_size", 640);
-
}
}
@@ -129,11 +128,10 @@ class core_installer {
$db->query("DROP TABLE IF EXISTS `permissions`;");
$db->query("DROP TABLE IF EXISTS `items`;");
$db->query("DROP TABLE IF EXISTS `modules`;");
- // @todo remove before release
- $db->query("DROP TABLE IF EXISTS `parameters`;");
- // @todo-end
$db->query("DROP TABLE IF EXISTS `vars`;");
system("/bin/rm -rf " . VARPATH . "albums");
system("/bin/rm -rf " . VARPATH . "resizes");
+ system("/bin/rm -rf " . VARPATH . "thumbs");
+ system("/bin/rm -rf " . VARPATH . "uploads");
}
}
diff --git a/core/helpers/photo.php b/core/helpers/photo.php
index da4ab0ac..00aff447 100644
--- a/core/helpers/photo.php
+++ b/core/helpers/photo.php
@@ -78,10 +78,10 @@ class photo_Core {
copy($filename, $photo->file_path());
// This saves the photo a second time, which is unfortunate but difficult to avoid.
- $thumbnail_size = module::get_var("core", "thumbnail_size");
+ $thumb_size = module::get_var("core", "thumb_size");
$resize_size = module::get_var("core", "resize_size");
- $result = $photo->set_thumbnail($filename, $thumbnail_size, $thumbnail_size)
+ $result = $photo->set_thumb($filename, $thumb_size, $thumb_size)
->set_resize($filename, $resize_size, $resize_size)
->save();