2012-01-17 40 views
1

我想知道如何使用media/catalog/product/cache的緩存,我不知道如何製作目錄結構。 我的例子是如何工作Magento中媒體/目錄/產品/緩存的緩存

media\catalog\product\cache 

    \1\small_image\120x120\9df78dab3d52sd08dse5fw8d27w36e95 

     a\ 
     b\ 
     d\ 
     ... 

我不知道如何利用高速緩存中的號碼1 \ 未來如何利用散列鍵9df78dab3d52sd08dse5fw8d27w36e95在higthxweith(目錄)代替採取numberx 並多次(目錄) 我需要知道所有,因爲我想製作一個外部CDN並解放來調整我的機器中的圖像。 THX

回答

5

如果您想了解更多有關散列鍵,我相信它是在Mage_Catalog_Model_Product_Image類中創建,在setBaseFile功能的底部,它主要負責圖像的特性,內爆在一起,並創建一個散列。

// add misk params as a hash 
    $miscParams = array(
      ($this->_keepAspectRatio ? '' : 'non') . 'proportional', 
      ($this->_keepFrame  ? '' : 'no') . 'frame', 
      ($this->_keepTransparency ? '' : 'no') . 'transparency', 
      ($this->_constrainOnly ? 'do' : 'not') . 'constrainonly', 
      $this->_rgbToString($this->_backgroundColor), 
      'angle' . $this->_angle, 
      'quality' . $this->_quality 
    ); 

    // if has watermark add watermark params to hash 
    if ($this->getWatermarkFile()) { 
     $miscParams[] = $this->getWatermarkFile(); 
     $miscParams[] = $this->getWatermarkImageOpacity(); 
     $miscParams[] = $this->getWatermarkPosition(); 
     $miscParams[] = $this->getWatermarkWidth(); 
     $miscParams[] = $this->getWatermarkHeigth(); 
    } 

如果您需要自己生成散列,則可以使用相同的步驟。顯然HASH'ing是一個單向過程,所以不可能取值並找出圖像屬性。

+0

謝謝,在這個方法中也找到了1(數字)。這引用了Mage :: app() - > getStore() - > getId() – davidselo 2012-01-17 15:12:18

+0

在同一個方法中引用了{$ this - > _ width} x {$ this - > _ height} – davidselo 2012-01-17 15:14:30