OSDN Git Service

ブログ記事から画像ギャラリー用に画像を抜き出す処理を追加。
[magic3/magic3.git] / widgets / blog_main / include / container / blog_mainEntryWidgetContainer.php
index c838ff6..c4f6793 100644 (file)
@@ -490,6 +490,11 @@ class blog_mainEntryWidgetContainer extends blog_mainBaseWidgetContainer
                                $html = $this->gInstance->getTextConvManager()->convToContentMacro($html);
                                $html2 = $this->gInstance->getTextConvManager()->convToContentMacro($html2);
                                
+                               // 記事に含まれるすべての画像のパスを取得
+                               $imagePathArray = $this->gInstance->getImageManager()->getSiteImagePath($html);
+                               $imagePathArray2 = $this->gInstance->getImageManager()->getSiteImagePath($html2);
+                               $imagePathArray = array_unique(array_merge($imagePathArray, $imagePathArray2));
+                               
                                // 追加パラメータ
                                $otherParams = array(   'be_description'                => $desc,               // 簡易説明
                                                                                'be_meta_description'   => $metaDesc,           // ページ要約(METAタグ)
@@ -501,10 +506,10 @@ class blog_mainEntryWidgetContainer extends blog_mainBaseWidgetContainer
 
                                // 記事データを追加
                                if (($this->isMultiLang && $this->langId == $this->gEnv->getDefaultLanguage()) || !$this->isMultiLang){         // 多言語でデフォルト言語、または単一言語のとき
-                                       $ret = self::$_mainDb->addEntryItem($nextEntryId * (-1)/*次のコンテンツIDのチェック*/, $this->langId, $name, $html, $html2, $status, $this->categoryArray, $this->blogId, 
+                                       $ret = self::$_mainDb->addEntryItem($nextEntryId * (-1)/*次のコンテンツIDのチェック*/, $this->langId, $name, $html, $html2, $status, $this->categoryArray, $imagePathArray, $this->blogId, 
                                                                                                        $this->_userId, $regDt, $startDt, $endDt, $showComment, $receiveComment, $newSerial, $otherParams);
                                } else {
-                                       $ret = self::$_mainDb->addEntryItem($this->entryId, $this->langId, $name, $html, $html2, $status, $this->categoryArray, $this->blogId, 
+                                       $ret = self::$_mainDb->addEntryItem($this->entryId, $this->langId, $name, $html, $html2, $status, $this->categoryArray, $imagePathArray, $this->blogId, 
                                                                                                        $this->_userId, $regDt, $startDt, $endDt, $showComment, $receiveComment, $newSerial, $otherParams);
                                }
                                if ($ret){
@@ -623,6 +628,11 @@ class blog_mainEntryWidgetContainer extends blog_mainBaseWidgetContainer
                                $html = $this->gInstance->getTextConvManager()->convToContentMacro($html);
                                $html2 = $this->gInstance->getTextConvManager()->convToContentMacro($html2);
                                
+                               // 記事に含まれるすべての画像のパスを取得
+                               $imagePathArray = $this->gInstance->getImageManager()->getSiteImagePath($html);
+                               $imagePathArray2 = $this->gInstance->getImageManager()->getSiteImagePath($html2);
+                               $imagePathArray = array_unique(array_merge($imagePathArray, $imagePathArray2));
+                               
                                // 追加パラメータ
                                $otherParams = array(   'be_description'                => $desc,               // 簡易説明
                                                                                'be_meta_description'   => $metaDesc,           // ページ要約(METAタグ)
@@ -641,7 +651,7 @@ class blog_mainEntryWidgetContainer extends blog_mainBaseWidgetContainer
                                }
                        
                                // 記事データを更新
-                               $ret = self::$_mainDb->updateEntryItem($this->serialNo, $name, $html, $html2, $status, $this->categoryArray, $this->blogId, 
+                               $ret = self::$_mainDb->updateEntryItem($this->serialNo, $name, $html, $html2, $status, $this->categoryArray, $imagePathArray, $this->blogId, 
                                                                                                        ''/*投稿者そのまま*/, $regDt, $startDt, $endDt, $showComment, $receiveComment, $newSerial, $oldRecord, $otherParams);
 /*                             if ($ret){
                                        // コンテンツに画像がなくなった場合は、サムネールを削除