Я пытаюсь настроить Media Plugin (https://github.com/davidpersson/media)
в core.php
require APP . 'plugins/media/config/core.php';
$xsmall = array('fitCrop' => array(75, 50));
$small = array('fitCrop' => array(75, 50));
$medium = array('fitCrop' => array(220, 140));
$large = array('fitCrop' => array(700, 335));
$xlarge = array('fitCrop' => array(700, 335));
Configure::write('Media.filter', array(
'audio' => array(),
'document' => array(),
'generic' => array(),
'image' => compact('small', 'medium', 'large'),
'video' => compact('medium', 'large')
));
из командной строки. Я создал начальные каталоги
В моей пользовательской модели я добавил это
class User extends AppModel {
var $name = 'User';
var $actsAs = array('Containable', 'Media.Transfer', 'Media.Generator', 'Media.Coupler');
Форма загрузки
<!-- Display Photo Form -->
<?php echo $this->Form->create('User', array( 'controller' => 'users','action' => 'display_photo', 'type' => 'file')); ?>
<?php echo $this->Form->input('id'); ?>
<?php echo $this->Form->file('display_photo'); ?>
<?php echo $this->Form->end(array('label' => 'Upload', 'id' => 'upload-button', 'name' => 'upload-button', 'div' => false)); ?>
<!-- Form Ends -->
Действие display_photo
function display_photo(){
if(!empty($this->data)) {
debug($this->data);
$this->User->save($this->data, array('fields' => array('display_photo')));
}
}
Ошибка
SQL Error: 1054: Unknown column 'Array' in 'field list'
[CORE\cake\libs\model\datasources\dbo_source.php, line 684]