summaryrefslogtreecommitdiff
path: root/core/helpers/album.php
diff options
context:
space:
mode:
authorBharat Mediratta <bharat@menalto.com>2008-11-05 09:42:47 +0000
committerBharat Mediratta <bharat@menalto.com>2008-11-05 09:42:47 +0000
commitae00f739445717885e2fc82e241bae38b7e58d44 (patch)
tree96feb40e2ffbaa61a46500288d3e7a8fe831d155 /core/helpers/album.php
parente35c154414ac73788645666b3e4e71722706c6cd (diff)
* Add thumbnail and resize dimensions to the item table and use them
properly in the theme. * Move thumbnail and resize generation down into the model for consistency. * Add a sample thumbnail for albums * Fix a bug in the ORM to clear the cache when we reload an object. * Add Kohana docs to the scaffold.
Diffstat (limited to 'core/helpers/album.php')
-rw-r--r--core/helpers/album.php13
1 files changed, 13 insertions, 0 deletions
diff --git a/core/helpers/album.php b/core/helpers/album.php
index 021c09f3..6934932e 100644
--- a/core/helpers/album.php
+++ b/core/helpers/album.php
@@ -54,4 +54,17 @@ class Album_Core {
}
return $album;
}
+
+ static function set_thumbnail($id, $filename) {
+ $album = ORM::factory("item", $id);
+
+ /** @todo: parameterize these dimensions */
+ $image = Image::factory($filename);
+ $image->resize(200, 140, Image::WIDTH)->save($album->thumbnail_path());
+
+ $dims = getimagesize($album->thumbnail_path());
+ $album->thumbnail_width = $dims[0];
+ $album->thumbnail_height = $dims[1];
+ return $album->save();
+ }
}