0

我正在使用来自https://github.com/jrbasso/MeioUpload的 MeioUpload 4.0 行为插件

我通过 git 安装了插件: git clone git://github.com/jrbasso/MeioUpload.git Plugin/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'
        )
    )
);
 }
 ?>

当我尝试访问 /pictures/add 时,我在 debug.log 中收到以下错误:

 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}
4

3 回答 3

0

首先,您需要在克隆文件夹时将文件夹重命名为 MeioUpload,它具有 ckaephp-MeioUpload 清晰且仅放

美欧上传

yourapp/app/config/boostrap.php

添加这个

CakePlugin::load('MeioUpload');

一切都很好:)

于 2013-03-29T00:15:49.303 回答
0

你把这条线放在你的引导程序中了吗?

CakePlugin::loadAll();
于 2013-02-01T15:17:32.597 回答
0

我有同样的问题。为了解决我这样做:

  • 将 MeioUploadBehavior.php 移至 /app/Model/Behavior 文件夹(即从其子文件夹中取出)
  • 加载不带点符号的行为。

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

不知道为什么将它放在子文件夹中会引发此版本 CakePHP 的缺失插件异常,但如果您想要临时修复,就是这样!

于 2012-05-11T21:58:11.427 回答