private function sendFile(Model_Attachment $attach, $download = false) { $view = new View_Raw($attach->getFilepath()); $view->mimetype = $attach->mimetype; $view->filename = $attach->filename; $view->download = $download; return $view; }
public function actionMetadata($params) { $attachment = new Model_Attachment($this->getStorage(), $params['id']); if ($attachment->getId()) { $view = new View_Json(); $view->id = $attachment->getId(); $view->info = $attachment->toArray(); if ($attachment->isImage() && $attachment->checkFile()) { $view->image = getimagesize($attachment->getFilepath()); } } else { $this->imageNotFound(); } return $view; }