2014-01-29 22 views
7

我遇到了麻煩,我的Magento安裝,在CMS中,當我去用wysiwig編輯器插入圖像的文件夾不斷打開。Magento 1.8.1:媒體目錄錯誤,如果使用符號鏈接

的文件夾結構應該是:

- infortis 
    - brands 
    - fortis 
    - ultimo 

但我得到的是:

-infortis 
    -infortis 
     -infortis 
      -infortis 
       -infortis 

而這只是不斷重複。

Magento版本1.8.1。任何幫助讚賞。

+0

只是爲了驗證,你使用任何第三方擴展或插件爲你編輯或媒體瀏覽器?這是否也發生在其他PC /瀏覽器上? 「media/wysiwyg」目錄中的目錄結構是否正確?最後:打開編輯器或圖像上傳器時是否收到任何javascript錯誤?對不起,所有的問題,只是想獲得更好的問題:) –

+0

@sandermangel我可以證實,這是一個問題,我們也有同樣的問題:(似乎'Mage_Cms_Helper_Wysiwyg_Images'不能很好地處理鏈接 – dmanners

+0

同樣的問題在EE上確認1.13.1.0 –

回答

11

我發現,以下編輯使得它的工作如預期,並與非符號鏈接(DEV)資源工程,以及:

在同一個班mentiond Mage_Cms_Helper_Wysiwyg_Images,應用這些補丁:

# This patch file was generated by NetBeans IDE 
# It uses platform neutral UTF-8 encoding and \n newlines. 
--- <html>Images.php (<b>Today 4:14:50 PM</b>)</html> 
+++ <html><b>Current File</b></html> 
@@ -223,7 +223,7 @@ 
    public function getCurrentUrl() 
    { 
     if (!$this->_currentUrl) { 
-   $path = str_replace(Mage::getConfig()->getOptions()->getMediaDir(), '', $this->getCurrentPath()); 
+   $path = str_replace(realpath(Mage::getConfig()->getOptions()->getMediaDir()), '', $this->getCurrentPath()); 
      $path = trim($path, DS); 
      $this->_currentUrl = Mage::app()->getStore($this->_storeId)->getBaseUrl('media') . 
            $this->convertPathToUrl($path) . '/'; 



# This patch file was generated by NetBeans IDE 
# It uses platform neutral UTF-8 encoding and \n newlines. 
--- <html>Images.php (<b>f47f0ff</b>)</html> 
+++ <html><b>Current File</b></html> 
@@ -68,7 +68,7 @@ 
     */ 
    public function getStorageRoot() 
    { 
-  return Mage::getConfig()->getOptions()->getMediaDir() . DS . Mage_Cms_Model_Wysiwyg_Config::IMAGE_DIRECTORY 
+  return realpath(Mage::getConfig()->getOptions()->getMediaDir()) . DS . Mage_Cms_Model_Wysiwyg_Config::IMAGE_DIRECTORY 
      . DS; 
    } 
+1

我爲此提出了一個錯誤:http://www.magentocommerce.com/bug-tracking/issue?issue=16088 – proxiblue

+0

這似乎打破了在wysiwyg中彈出圖像的縮略圖編輯器雖然..它沒有把「wysiwyg」的網址,所以它看起來像這樣:'https://blabla.com/media//.thumbs/img.png?rand=1399016538'將調試時,我得到機會 – Erfan

+2

@Erfan在那裏,完成了:) http://magento.stackexchange.com/questions/14820/magento-1-8-1-0-wysiwyg-editor-is-not-displaying-thumbnails-in-image -manager – proxiblue

2

發現在Mage_Cms_Helper_Wysiwyg_Images::convertIdToPath

問題的核心代碼如下。

public function convertIdToPath($id) 
{ 
    $path = $this->idDecode($id); 
    if (!strstr($path, $this->getStorageRoot())) { 
     $path = $this->getStorageRoot() . $path; 
    } 
    return $path; 
} 

而修復方法是在獲取存儲根目錄時使用實際路徑,如下所示。

public function convertIdToPath($id) 
{ 
    $path = $this->idDecode($id); 
    $realpath = $this->getStorageRoot(); 
    if (is_link(rtrim($realpath,'/'))) { 
     $realpath = realpath($realpath); 
    } 
    if (!strstr($path, $realpath)) { 
     $path = $realpath . $path; 
    } 
    return $path; 
} 

所以我們所做的就是重寫Mage_Cms_Helper_Wysiwyg_Images和使用更新converIdToPath功能。我找到了原始解決方案on a German website,但是如果你有一個沒有鏈接的開發系統和另一個有鏈接的系統,那麼這個解決方案就會中斷。

0

我們最近遇到了這個問題,我想分享一些信息來保存下一個人的一些時間。如果你正在運行Magento企業版並且有一個有效的支持協議,那麼可以使用官方補丁。只需打開支持憑單並直接申請補丁。補丁名稱是「PATCH_SUPEE-2662_EE_1.13.1.0_v1」。

相關問題