/** * Configure Uploader manually. * * @param bool|int $id * @param string $table * @param string $ds */ public function __construct($id = false, $table = null, $ds = null) { $config = Configure::read('Tournament.uploads'); $transport = $config['transport']; if ($transport) { $transport['folder'] = 'tournament/teams/'; } $this->actsAs['Uploader.Attachment'] = array('logo' => array('nameCallback' => 'formatFilename', 'uploadDir' => WWW_ROOT . 'files/tournament/teams/', 'finalPath' => 'files/tournament/teams/', 'dbColumn' => 'logo', 'overwrite' => true, 'stopSave' => true, 'allowEmpty' => false, 'transport' => $transport, 'transforms' => array('logo' => array('method' => 'crop', 'width' => $config['teamLogo'][0], 'height' => $config['teamLogo'][1], 'self' => true, 'overwrite' => true)))); $this->actsAs['Uploader.FileValidation'] = array('logo' => array('minWidth' => $config['teamLogo'][0], 'minHeight' => $config['teamLogo'][1], 'extension' => array('gif', 'jpg', 'jpeg', 'png'), 'type' => array('image/gif', 'image/jpg', 'image/jpeg', 'image/png'), 'required' => true)); parent::__construct($id, $table, $ds); }
/** * Configure Uploader manually. * * @param bool|int $id * @param string $table * @param string $ds */ public function __construct($id = false, $table = null, $ds = null) { $config = Configure::read('Tournament.uploads'); $transport = $config['transport']; if ($transport) { $transport['folder'] = 'tournament/matches/'; } $attachment = array('nameCallback' => 'formatFilename', 'uploadDir' => WWW_ROOT . 'files/tournament/matches/', 'finalPath' => 'files/tournament/matches/', 'overwrite' => true, 'stopSave' => true, 'allowEmpty' => false, 'transport' => $transport); $this->actsAs['Uploader.Attachment'] = array('screenshot' => $attachment, 'replay' => $attachment); $this->actsAs['Uploader.FileValidation'] = array('screenshot' => array('extension' => array('jpg', 'jpeg', 'png'), 'type' => array('image/jpg', 'image/jpeg', 'image/png'), 'required' => true), 'replay' => array('required' => true)); parent::__construct($id, $table, $ds); }