view->registerMetaTag([ 'name' => 'description', 'content' => $this->description, ]); Yii::$app->view->registerMetaTag([ 'name' => 'keywords', 'content' => $this->keywords, ]); Yii::$app->view->registerMetaTag([ 'name' => 'og:description', 'content' => $this->description, ]); Yii::$app->view->registerMetaTag([ 'name' => 'og:type', 'content' => 'websites', ]); Yii::$app->view->registerMetaTag([ 'name' => 'og:image', 'content' => $this->image, ]); Yii::$app->view->registerMetaTag([ 'name' => 'twitter:description', 'content' => $this->description, ]); Yii::$app->view->registerMetaTag([ 'name' => 'twitter:image', 'content' => $this->image, ]); } public function getFirstImage($content) { $first_img = ''; $output = preg_match_all('//i', $content, $matches); $first_img = $matches[1][0]; if(empty($first_img)) { $first_img = 'http://new.ubon5.go.th/img/nopic.jpg'; } return $first_img; } }