From 2389d66da849798f8d4ec5f10e3b07c11da49185 Mon Sep 17 00:00:00 2001 From: Michael Francis Date: Sat, 28 May 2011 13:28:16 -0400 Subject: Initial Commit --- models/ProfilePic.php | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) create mode 100644 models/ProfilePic.php (limited to 'models/ProfilePic.php') diff --git a/models/ProfilePic.php b/models/ProfilePic.php new file mode 100644 index 0000000..079f5b7 --- /dev/null +++ b/models/ProfilePic.php @@ -0,0 +1,28 @@ + 'fs.files'); + + //Overriding save to do the thumbnailing :) + public function save($entity, $data, array $options = array()) + { + //Create a new imagemagick object from the uploaded file + $im = new Imagick($data['file']); + + //Create a thumbnail of the file, then store it in the "thumbnail" object + $data['thumbnail'] = $im->thumbnailImage(200, null); + + //Pass the changes off to the original save method. + return parent::save($entity, $data, $options); + } +} + +?> \ No newline at end of file -- cgit v1.2.3