Example #1
0
 /**
  * Define Uploader Attachment configuration dynamically.
  *
  * @param bool $id
  * @param string $table
  * @param string $ds
  */
 public function __construct($id = false, $table = null, $ds = null)
 {
     if (CakePlugin::loaded('Uploader')) {
         $transforms = array('path' => array('method' => 'exif', 'self' => true)) + Configure::read('Admin.uploads.transforms');
         $this->actsAs['Uploader.Attachment'] = array('path' => array('nameCallback' => 'formatName', 'overwrite' => true, 'metaColumns' => array('size' => 'size', 'ext' => 'ext', 'type' => 'type', 'height' => 'height', 'width' => 'width'), 'transforms' => $transforms, 'transport' => Configure::read('Admin.uploads.transport')));
         $this->actsAs['Uploader.FileValidation'] = array('path' => Configure::read('Admin.uploads.validation'));
     } else {
         $this->admin = false;
     }
     parent::__construct($id, $table, $ds);
 }