diff options
Diffstat (limited to 'core/helpers/album.php')
-rw-r--r-- | core/helpers/album.php | 13 |
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(); + } } |