2012-01-17 44 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