From c208f59e87717fb5342bf03082f050f2738a1d8b Mon Sep 17 00:00:00 2001 From: William Date: Wed, 23 Jul 2014 12:32:02 -0300 Subject: [PATCH 1/3] Corrected runtime exception message that was missing a H in the word attach --- View/Helper/AttachHelper.php | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/View/Helper/AttachHelper.php b/View/Helper/AttachHelper.php index 6520ae1..86fc31e 100644 --- a/View/Helper/AttachHelper.php +++ b/View/Helper/AttachHelper.php @@ -1,7 +1,7 @@ Date: Thu, 24 Jul 2014 12:29:09 -0300 Subject: [PATCH 2/3] Fix the methods signature and passing parameters --- Model/Behavior/UploadBehavior.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/Model/Behavior/UploadBehavior.php b/Model/Behavior/UploadBehavior.php index 5a42a17..3f2c272 100644 --- a/Model/Behavior/UploadBehavior.php +++ b/Model/Behavior/UploadBehavior.php @@ -642,11 +642,11 @@ public function createThumbs(Model $model, $type, $file) { * * @return void */ - public function createThumb($file, $name, $width, $height, $crop = false) { - $imagine = $this->getImagine(); + public function createThumb(Model $model, $file, $name, $width, $height, $crop = false) { + $imagine = $this->getImagine($model); $image = $imagine->open($file); - $this->__generateThumb( + $this->_generateThumb( array( 'w' => $width, 'h' => $height, @@ -696,7 +696,7 @@ protected function _generateThumb($thumb, $image, $crop = false) { $mode = Imagine\Image\ImageInterface::THUMBNAIL_INSET; } - $thumbnail = $image->thumbnail( + $thumbnail = $image->thumbnail( new Imagine\Image\Box( $thumb['w'], $thumb['h'] From ca237f7a71169b2a56ada5145237098e4e854e2e Mon Sep 17 00:00:00 2001 From: Lucas Vieira Date: Tue, 26 Aug 2014 14:24:40 -0300 Subject: [PATCH 3/3] Fixed a bug when the type uses underscore. It was using the strtolower to set the type, but since it used the Inflector::camelize to set the relation, it need to use the Inflector::underscode to get the initial value. --- Model/Behavior/UploadBehavior.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Model/Behavior/UploadBehavior.php b/Model/Behavior/UploadBehavior.php index 3f2c272..e637612 100644 --- a/Model/Behavior/UploadBehavior.php +++ b/Model/Behavior/UploadBehavior.php @@ -87,7 +87,7 @@ protected function _setRelationModel(Model $model, $type) { 'dependent' => true, 'conditions' => array( 'Attachment' . $type . '.model' => $model->alias, - 'Attachment' . $type . '.type' => strtolower($type)), + 'Attachment' . $type . '.type' => Inflector::underscore($type)), 'fields' => '', 'order' => '' );