public function afterValidate() { if (!$this->hasErrors()) { $this->_imageContent = $this->getImageContent(); $validator = new ImageValidator(['imageTypes' => Module::getInstance()->params['ImageTypes'], 'maxSize' => Module::getInstance()->params['MaxSizePhoto']]); if (!$validator->validate($this->getImageContent(), $error)) { $this->addError('base64Image', $error); } } parent::afterValidate(); }
/** * @return self */ private function _init() { $this->_objFileInformation = $this->_objRoundSaveThumb->getFileInformation()->one(); $this->_objFile = $this->_objFileInformation->getFile()->one(); $this->_objThumbsCategory = $this->_objRoundSaveThumb->getThumbsCategory()->one(); $this->_basePath = Module::getInstance()->params['file']['BASE_DIR']; $this->_originalFilePath = $this->_objFile->getFilePath(); $this->_fileExtention = image_type_to_extension($this->_objFile->getType()); $pattern = '#(.*\\/)' . Module::getInstance()->params['file']['FILE_ORIGINAL_NAME'] . '\\.#ui'; preg_match($pattern, $this->_originalFilePath, $arrSaveDir); $this->_thumbFileSaveDir = $arrSaveDir[1]; return $this; }