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 に答える