Example #1
0
 public function getProportionalHeight(int $width)
 {
     // obtiene el tamaƱo actual
     list($originalWidth, $originalHeight) = @getimagesize(File::getUserUploadDirectory() . $this->getInternalFilename());
     // retorna la altura proporcional
     return $width * $originalHeight / $originalWidth;
 }
Example #2
0
 public function executeDownloadFile(sfWebRequest $request)
 {
     // TODO: validar acceso al archivo por parte del usuario
     $file = Doctrine::getTable('File')->find(array($request->getParameter('id')));
     $filePath = File::getUserUploadDirectory() . $file->getInternalFilename();
     // check if the file exists
     $this->forward404Unless(file_exists($filePath));
     $this->prepareDownload($file->getOriginalFilename(), $file->getSize(), $file->getContentType());
     $this->getResponse()->setContent(@readfile($filePath));
     flush();
     return sfView::NONE;
 }