Exemple #1
0
 /**
  * @see Form::validate()
  */
 function validate()
 {
     if ($temporaryFileId = $this->getData('temporaryFileId')) {
         import('lib.pkp.classes.file.TemporaryFileManager');
         $temporaryFileManager = new TemporaryFileManager();
         $temporaryFileDao = DAORegistry::getDAO('TemporaryFileDAO');
         $temporaryFile = $temporaryFileDao->getTemporaryFile($temporaryFileId, $this->_userId);
         if (!$temporaryFile || !($this->_imageExtension = $temporaryFileManager->getImageExtension($temporaryFile->getFileType())) || !($this->_sizeArray = getimagesize($temporaryFile->getFilePath())) || $this->_sizeArray[0] <= 0 || $this->_sizeArray[1] <= 0) {
             $this->addError('temporaryFileId', __('form.invalidImage'));
             return false;
         }
     }
     return parent::validate();
 }