0

我想从 \skin\frontend\\default\images 位置显示调整大小的图像。现在我正在使用简单的 <img src="<?php echo $this->getSkinUrl('images/free_shipping.png')?>" alt="Free Shipping" /> 任何人都可以告诉我吗?

4

1 回答 1

0

默认情况下,magento 仅允许您调整目录图像的大小,但您可以创建自己的功能来调整皮肤图像的大小。见http://magedev.com/2009/08/16/magento-image-manipulation/

$fileName = 'skin\frontend\default\default\images\media\col_left_callout.jpg';

$image = new Varien_Image($fileName);

// this function accepts integer, hexadecimal format is more convenient for me
$image->setImageBackgroundColor(0xFFFFFF);

$image->resize(250);


// this will generate proper headers for transformed image so don't use this method if you plan to display any other content
$image->display();

// Magento will attempt to create missing directories
$image->save('media/myimages/myTransformedImage.jpg');

另见

于 2013-04-15T13:44:42.133 回答