2012-03-29 138 views
0

我是Magento新手。我對magento中使用的圖像很困惑。我已將產品列表中的默認圖像尺寸135x135更改爲300X400。但現在的問題是,確切的產品頁面圖像具有黑色背景圖像&而檢查元素它顯示的尺寸爲267x267。Magento如何刪除圖像背景中的黑色圖像

PLZ解釋我。我想還我使用的變焦效果擴展在

  1. 產品頁面的圖像尺寸爲300X400
  2. 內準確的產品形象爲300X400
  3. 。 onhover時,圖像不應該像素化。那麼上傳產品圖片時應該使用什麼樣的圖片尺寸?

回答

1

使用以下代碼

echo $this->helper('catalog/image')->init($_product, 'image')->constrainOnly(true)->keepAspectRatio(true)->keepFrame(false)->resize(300, null) 

該代碼將調整圖像,而不影響圖像比率。如果您給定了固定的寬度和高度,調整大小的圖像將失去原創性。

0

我在Magento社區發現了一條評論。要解決黑色背景 去GD2.php線301後:

$this->_fillBackgroundColor($newImage); 

把這個代碼:

$whitebg=imagecolorallocate($newImage,255,255,255); 
imagefilledrectangle($newImage,0,0,$frameWidth,$frameHeight,$whitebg); 

準備好了!

0

解決方案:

<?php echo $this->helper('catalog/image')->init($_product, 'small_image')->keepTransparency(false); ?>