Ejemplo n.º 1
0
 /**
  * Adds a photo
  * 
  * @param array $input Raw input data
  * @return boolean
  */
 public function add(array $input)
 {
     $input = $this->prepareInput($input);
     $data =& $input['data']['photo'];
     $file =& $input['files']['file'];
     $data['photo'] = $file[0]->getName();
     $data['date'] = time();
     $this->track('A new photo "%s" has been uploaded', $data['name']);
     // Insert must be first, so that we can get the last id
     return $this->photoMapper->insert($data) && $this->imageManager->upload($this->getLastId(), $file);
 }