【问题标题】:How to work Cache of media/catalog/product/cache in Magento如何在 Magento 中工作媒体/目录/产品/缓存的缓存
【发布时间】:2012-02-12 06:22:56
【问题描述】:

我想知道如何使用媒体/目录/产品/缓存的缓存我不知道目录结构是如何制作的。 我的例子是

media\catalog\product\cache

  \1\small_image\120x120\9df78dab3d52sd08dse5fw8d27w36e95

      a\
      b\
      d\
      ...

我不明白如何在缓存中获取数字 1\ 接下来如何获取哈希键 9df78dab3d52sd08dse5fw8d27w36e95 并多次代替 higthxweith(directory) 取 numberx(directory) 我需要知道一切,因为我想制作一个外部 CDN 并解放以调整我机器中的图像大小。 谢谢

【问题讨论】:

    标签: image caching magento


    【解决方案1】:

    如果您想了解更多关于该哈希键的信息,我相信它是在 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是一个单向过程,因此不可能取值并找出图像属性。

    【讨论】:

    • 谢谢,在这个方法中也可以找到 1(数字)。这参考了 Mage::app()->getStore()->getId()
    • 数x数以同样的方式引用了{$this->_width}x{$this->_height}
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2015-04-29
    • 1970-01-01
    • 2012-04-01
    相关资源
    最近更新 更多