2012-04-12 61 views
0

我使用MeioUpload 4.0插件的行爲從https://github.com/jrbasso/MeioUpload集成在CakePHP MeioUpload行爲2.1.1

我通過安裝的git插件:混帳混帳克隆://github.com/jrbasso/MeioUpload.git插件/ MeioUpload 現在,我的目錄結構是這樣的:

/app 
/Plugin 
    /MeioUpload 
    /Model 
    /Behavior 
    /MeioUploadBehavior.php 
    /Locale 
    /Test 

我的圖片模型是這樣的:

<?php 
App::uses('AppModel', 'Model'); 
class Picture extends AppModel { 
$actsAs = array(
    'MeioUpload.MeioUpload' => array(
     'picture' => array(
      'dir' => 'img{DS}pictures', 
      'create_directory' => true, 
      'allowed_mime' => array('image/jpeg', 'image/pjpeg', 'image/png'), 
      'allowed_ext' => array('.jpg', '.jpeg', '.png'), 
      'zoomCrop' => true,    
      'thumbsizes' => array(
       'small' => array('width'=>165, 'height'=>115), 
       'medium' => array('width'=>800, 'height'=>600) 

      ), 
      'default' => 'default.jpg' 
     ) 
    ) 
); 
} 
?> 

當我試圖訪問/圖片/加時I g et在調試日誌中出現以下錯誤:

2012-04-12 21:42:38 Error: [MissingPluginException] Plugin MeioUpload could not be found. 
#0 C:\wamp\www\starter211\lib\Cake\Core\App.php(364): CakePlugin::path('MeioUpload') 
#1 C:\wamp\www\starter211\lib\Cake\Core\App.php(225): App::pluginPath('MeioUpload') 
#2 C:\wamp\www\starter211\lib\Cake\Core\App.php(542): App::path('Model/Behavior', 'MeioUpload') 
#3 [internal function]: App::load('MeioUploadBehav...') 
#4 [internal function]: spl_autoload_call('MeioUploadBehav...') 
#5 C:\wamp\www\starter211\lib\Cake\Model\BehaviorCollection.php(121): class_exists('MeioUploadBehav...') 
#6 C:\wamp\www\starter211\lib\Cake\Model\BehaviorCollection.php(68): BehaviorCollection->load('MeioUpload.Meio...', Array) 
#7 C:\wamp\www\starter211\lib\Cake\Model\Model.php(725): BehaviorCollection->init('Picture', Array) 
#8 [internal function]: Model->__construct(Array) 
#9 C:\wamp\www\starter211\lib\Cake\Utility\ClassRegistry.php(156): ReflectionClass->newInstance(Array) 
#10 C:\wamp\www\starter211\lib\Cake\View\Helper\FormHelper.php(145): ClassRegistry::init(Array) 
#11 C:\wamp\www\starter211\lib\Cake\View\Helper\FormHelper.php(331): FormHelper->_getModel('Picture') 
#12 C:\wamp\www\starter211\app\View\Pictures\add.ctp(2): FormHelper->create('Picture', Array) 
#13 C:\wamp\www\starter211\lib\Cake\View\View.php(908): include('C:\wamp\www\sta...') 
#14 C:\wamp\www\starter211\lib\Cake\View\View.php(872): View->_evaluate('C:\wamp\www\sta...', Array) 
#15 C:\wamp\www\starter211\lib\Cake\View\View.php(463): View->_render('C:\wamp\www\sta...') 
#16 C:\wamp\www\starter211\lib\Cake\Controller\Controller.php(959): View->render(NULL, NULL) 
#17 C:\wamp\www\starter211\lib\Cake\Routing\Dispatcher.php(110): Controller->render() 
#18 C:\wamp\www\starter211\lib\Cake\Routing\Dispatcher.php(85): Dispatcher->_invoke(Object(PicturesController), Object(CakeRequest), Object(CakeResponse)) 
#19 C:\wamp\www\starter211\app\webroot\index.php(96): Dispatcher->dispatch(Object(CakeRequest), Object(CakeResponse)) 
#20 {main} 

回答

0

我有同樣的問題。要解決我這樣做:

  • 移動MeioUploadBehavior.php到/應用/型號/行爲的文件夾(即取出其子文件夾)
  • 負荷的行爲,而點符號。

    $actsAs = array(
        'MeioUpload' => array(...options here...) 
    ); 
    

不知道爲什麼有它的子目錄下,拋出缺少插件例外此版本的CakePHP的,但如果你想有一個臨時補丁,這是它!

0

你把這條線放在引導程序中嗎?

CakePlugin::loadAll(); 
0

杉杉你需要的時候你克隆到的文件夾,以MeioUpload重新命名它具有ckaephp-MeioUpload清晰和在線訂購把

MeioUpload在

yourapp

/app/config/boostrap.php

添加此

CakePlugin ::負載( 'MeioUpload');

and all working good :)