cakephp2.9.1 で画像を保存するために uploadpack プラグインを利用しています。
リサイズを指定していない状態であれば普通に画像の保存はできるのですが、
var $actsAs = [
"UploadPack.Upload" => [
"img" => [
"styles" => [
"normal" => "785×480"
]
]
]
];
上記のようにリサイズを指定すると、保存時に以下のエラーが表示されます。
Notice (8): Undefined variable: destH [APP/Plugin/upload_pack/Model/Behavior/UploadBehavior.php, line 305]
Code Context
UploadBehavior::_resize() - APP/Plugin/upload_pack/Model/Behavior/UploadBehavior.php, line 305
UploadBehavior::_writeFiles() - APP/Plugin/upload_pack/Model/Behavior/UploadBehavior.php, line 152
UploadBehavior::afterSave() - APP/Plugin/upload_pack/Model/Behavior/UploadBehavior.php, line 68
ObjectCollection::trigger() - CORE/Cake/Utility/ObjectCollection.php, line 128
call_user_func - [internal], line ??
CakeEventManager::dispatch() - CORE/Cake/Event/CakeEventManager.php, line 243
Model::_doSave() - CORE/Cake/Model/Model.php, line 1968
Model::save() - CORE/Cake/Model/Model.php, line 1752
Model::saveAssociated() - CORE/Cake/Model/Model.php, line 2513
BusinessCardsController::edit() - APP/Controller/BusinessCardsController.php, line 74
ReflectionMethod::invokeArgs() - [internal], line ??
Controller::invokeAction() - CORE/Cake/Controller/Controller.php, line 491
Dispatcher::_invoke() - CORE/Cake/Routing/Dispatcher.php, line 193
Dispatcher::dispatch() - CORE/Cake/Routing/Dispatcher.php, line 167
[main] - APP/webroot/index.php, line 111
Notice (8): Undefined variable: resizeMode [APP/Plugin/upload_pack/Model/Behavior/UploadBehavior.php, line 309]
Notice (8): Undefined variable: resizeMode [APP/Plugin/upload_pack/Model/Behavior/UploadBehavior.php, line 321]
Warning (2): imagecreatetruecolor() [function.imagecreatetruecolor]: Invalid image dimensions [APP/Plugin/upload_pack/Model/Behavior/UploadBehavior.php, line 334]
Warning (2): imagecolorallocate() expects parameter 1 to be resource, boolean given [APP/Plugin/upload_pack/Model/Behavior/UploadBehavior.php, line 351]
Warning (2): imagefill() expects parameter 1 to be resource, boolean given [APP/Plugin/upload_pack/Model/Behavior/UploadBehavior.php, line 351]
Warning (2): imagecopyresampled() expects parameter 1 to be resource, boolean given [APP/Plugin/upload_pack/Model/Behavior/UploadBehavior.php, line 353]
Warning (2): imagejpeg() expects parameter 1 to be resource, boolean given [APP/Plugin/upload_pack/Model/Behavior/UploadBehavior.php, line 354]
このようなエラーが表示されてもDBの保存はきちんと行われており、画像もリサイズ自体はされていませんが、画像名_original.jpg
と 画像名_normal.jpg
が生成されています。
どうすれば正常にリサイズできるようになるでしょうか?
よろしくお願いします。