2012-09-18 5 views
1

175x175 프레임에 맞게 크기 이미지를 표시하므로 카테고리 페이지에서 원래 모양이 손실됩니다.Magento에서 크기를 조정 한 후 카테고리 이미지를 표시하는 방법은 무엇입니까?

제품 이미지의 크기가 조정되고 표시되는 것과 같은 크기 조정 후에 카테고리 이미지를 표시하려고합니다.

Magento 1.7.0.2에서 어떻게 할 수 있습니까?

+0

시도해보십시오. - https://github.com/dbashyal/Magento-resize-category-images (self) –

답변

1
당신은 maually 젠토의 이미지 libs와를 사용하여 크기를 조정해야합니다

는, 예를 들어 (http://blog.chapagain.com.np/magento-resize-image/를) herwes :

// actual path of image 
$imageUrl = Mage::getBaseDir('media').DS."myimage".DS.$post->getThumbnail(); 

// path of the resized image to be saved 
// here, the resized image is saved in media/resized folder 
$imageResized =  Mage::getBaseDir('media').DS."myimage".DS."resized".DS.$post->getThumbnail(); 

// resize image only if the image file exists and the resized image file doesn't exist 
// the image is resized proportionally with the width/height 135px 
if (!file_exists($imageResized)&&file_exists($_imageUrl)) : 
    $imageObj = new Varien_Image($_imageUrl); 
    $imageObj->constrainOnly(TRUE); 
    $imageObj->keepAspectRatio(TRUE); 
    $imageObj->keepFrame(FALSE); 
    $imageObj->resize(135, 135); 
    $imageObj->save($imageResized); 
endif; 

$newImageUrl = Mage::getBaseUrl('media')."catalog/category/resized/".$imageName; 

당신이 걸릴 경우 Varien_Image를 보면 이미지 크기를 조정하는 데 도움이되는 몇 가지 방법이 있습니다. 불행히도 제품 이미지가있는 것처럼 사용할 수있는 도우미가 없지만이를 수행하는 도우미를 만드는 것은 어렵지 않습니다.

관련 문제