/** * create thumbs for image process */ public function process() { $roundList = RoundSaveThumb::find()->where(['status' => Status::CREATED])->all(); foreach ($roundList as $roundObj) { $createHelper = new CreateThumbsFileHelper($roundObj); $createHelper->process(); } return true; }
/** * @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; }
/** * @return \yii\db\ActiveQuery */ public function getImageRoundSaveThumbs() { return $this->hasMany(RoundSaveThumb::className(), ['thumbs_category_id' => 'id']); }
/** * @return \yii\db\ActiveQuery */ public function getImageRoundSaveThumbs() { return $this->hasMany(RoundSaveThumb::className(), ['file_information_id' => 'id']); }