public function uploadImage($formFieldName) { $request = Application::getInstance()->request; if (!$request->existsFilesData() || !$request->isUploaded($formFieldName) || $request->isUploadedArray($formFieldName)) { return $this; } try { $uploader = new Uploader($formFieldName); $uploader->setPath('/public/news/stories/images'); $image = $uploader(); if ($this->image) { $this->deleteImage(); } $this->image = $image; } catch (Exception $e) { $this->image = null; } return $this; }
public function actionEdit($__album_id = null, $id = null) { $this->data->id = $id; if (!null == $id) { $this->data->item = Photo::findByPK($id); } else { $uploader = new Uploader('image'); $uploader->setPath('/public/gallery/photos'); $images = $uploader(); $this->data->items = $images; } if (null == $__album_id) { $__album_id = $this->app->request->post->__album_id; } $album = $this->data->album = Album::findByColumn('__id', $__album_id); if ($album->__prt) { $this->data->albumParent = Album::findByColumn('__id', $album->__prt); } }
public function actionGetImage() { $uploader = new Uploader('image'); $uploader->setPath('/public/news/stories/images'); $image = $uploader(); $this->data->filelink = $image; }
public function actionPhotoEdit($id = null, $page_id) { $this->data->id = $id; if (!null == $id) { $this->data->item = Photo::findByPK($id); $this->data->page_id = $page_id; } else { $uploader = new Uploader('image'); $uploader->setPath('/rubrics/page/photos'); $images = $uploader(); $this->data->items = $images; $this->data->page_id = $page_id; } }