Exemplo n.º 1
0
 public function getThumbnails($ref, $event_name)
 {
     $uploadFiles = Uploadsp::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
 public function actionDeletefileAjax()
 {
     $model = Uploadsp::findOne(Yii::$app->request->post('key'));
     if ($model !== NULL) {
         $filename = Priskhead::getUploadPath() . $model->ref . '/' . $model->real_filename;
         $thumbnail = Priskhead::getUploadPath() . $model->ref . '/thumbnail/' . $model->real_filename;
         if ($model->delete()) {
             @unlink($filename);
             @unlink($thumbnail);
             echo json_encode(['success' => true]);
         } else {
             echo json_encode(['success' => false]);
         }
     } else {
         echo json_encode(['success' => false]);
     }
 }