public function getThumbnails($ref, $event_name)
 {
     $uploadFiles = Uploads::find()->where(['ref' => $ref])->all();
     $preview = [];
     foreach ($uploadFiles as $file) {
         $preview[] = ['url' => self::getUploadUrl(true) . $ref . '/' . $file->real_filename, 'src' => self::getUploadUrl(true) . $ref . '/thumbnail/' . $file->real_filename, 'options' => ['title' => $event_name]];
     }
     return $preview;
 }
Exemplo n.º 2
0
 /**
  * Get a file by ID
  * 
  *  The function returns TRUE or FALSE on failure. If success the file is available in $file param.
  * @param int $id ID to get
  * @param object $file Reference to the object
  * @return bool
  */
 protected function getUpload($id, &$file)
 {
     $file = null;
     $success = false;
     $request_details = array('conditions' => array('upload_id' => $id));
     if ($id > 0) {
         $success = ($file = Uploads::find('first', $request_details)) ? true : false;
     }
     return $success;
 }
Exemplo n.º 3
0
 private function getInitialPreview($ref)
 {
     $datas = Uploads::find()->where(['ref' => $ref])->all();
     $initialPreview = [];
     $initialPreviewConfig = [];
     foreach ($datas as $key => $value) {
         array_push($initialPreview, $this->getTemplatePreview($value));
         array_push($initialPreviewConfig, ['caption' => $value->filename, 'width' => '120px', 'url' => Url::to(['/album/deletefile-ajax']), 'key' => $value->id]);
     }
     return [$initialPreview, $initialPreviewConfig];
 }