From 591131695098cdae4e2c593aa9439d0300a30355 Mon Sep 17 00:00:00 2001 From: Juan Basso Date: Sat, 27 Feb 2010 14:04:50 -0300 Subject: [PATCH] Fix warning when not set width or height in thumbsizes. Fixes #30. --- models/behaviors/meio_upload.php | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/models/behaviors/meio_upload.php b/models/behaviors/meio_upload.php index 08b5aa2..70c4dec 100644 --- a/models/behaviors/meio_upload.php +++ b/models/behaviors/meio_upload.php @@ -36,7 +36,6 @@ class MeioUploadBehavior extends ModelBehavior { // Place any custom thumbsize in model config instead, ), 'thumbnailQuality' => 75, // Global Thumbnail Quality - 'maxDimension' => null, // Can be null, h, or w 'useImageMagick' => false, 'imageMagickPath' => '/usr/bin/convert', // Path to imageMagick on your server 'fields' => array( @@ -749,10 +748,13 @@ function _createThumbnails(&$model, $data, $fieldName, $saveAs, $ext, $options) } else { $thumbSaveAs = $this->_getThumbnailName($saveAs, $options['dir'], $key, $data[$model->alias][$fieldName]['name']); } - $params = array( - 'thumbWidth' => $value['width'], - 'thumbHeight' => $value['height'] - ); + $params = array(); + if (isset($value['width'])) { + $params['thumbWidth'] = $value['width']; + } + if (isset($value['height'])) { + $params['thumbHeight'] = $value['height']; + } if (isset($value['maxDimension'])) { $params['maxDimension'] = $value['maxDimension']; }