summaryrefslogtreecommitdiff
path: root/core/helpers/photo.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/photo.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/photo.php')
-rw-r--r--core/helpers/photo.php15
1 files changed, 8 insertions, 7 deletions
diff --git a/core/helpers/photo.php b/core/helpers/photo.php
index dfa67e2b..ef94f52b 100644
--- a/core/helpers/photo.php
+++ b/core/helpers/photo.php
@@ -52,14 +52,15 @@ class Photo_Core {
$photo->name = rand() . "." . $pi["extension"];
}
- $photo->add_to_parent($parent_id);
-
copy($filename, $photo->file_path());
- /** @todo: parameterize these values */
- $image = Image::factory($filename);
- $image->resize(200, 140, Image::WIDTH)->save($photo->thumbnail_path());
- $image->resize(800, 600, Image::WIDTH)->save($photo->resize_path());
- return $photo;
+ // This saves the photo
+ $photo->add_to_parent($parent_id);
+
+ /** @todo: parameterize these dimensions */
+ // This saves the photo a second time, which is unfortunate but difficult to avoid.
+ return $photo->set_thumbnail($filename, 200, 140)
+ ->set_resize($filename, 800, 600)
+ ->save();
}
}