magento如何提高模糊框的图像质量

时间:2018-07-04 12:57:20

标签: magento magento-1.8 magento-1.4

我正在使用Magento 1.14 EE,试图提高不影响帧图像的图像质量。

app \ design \ frontend \ mytheme \ default \ template \ catalog \ product \ list \ quickview \ product.phtml

<div class="slider-wrapper">
            <div class="main-slider">

            <?php 
                $_imgSize = 900;
                $Products_one = Mage::getModel('catalog/product')->load($_product->getId());
                $mediacount = count($Products_one->getMediaGalleryImages());
                // Use your Product Id instead of $id
                $countt = count($Products_one->getMediaGalleryImages());
                if($countt>0){
                    foreach ($Products_one->getMediaGalleryImages() as $_image)
                    {   
                        $resizeimage = $obj->helper('catalog/image')->init($_prod, 'small_image', $_image->getFile())->resize($_imgSize)->setQuality(100);
                        //$resizeimage = $obj->helper('catalog/image')->init($_prod, 'framed_image', $_image->getFile())->backgroundColor(242,242,242)->resize(460,500);
                        echo " <div itemprop='image'  class='slider slider-item'><a href='".$_product->getProductUrl()."'><img src='".$resizeimage."' alt='' /></a></div>";
                    }
                }?>
            </div>
  </div>

也尝试过下面一行,但不影响:

$resizeimage = $obj->helper('catalog/image')->init($_prod, 'small_image', $_image->getFile())->keepAspectRatio(true)->keepFrame(true)->keepTransparency(true)->backgroundColor(array(255,255,255))->resize($_imgSize)->setQuality(100);

我正在尝试调试(仅获取图像路径),并且从我的产品集中获得的图像为:

$sku = '30-4287'; 
$productCollection = Mage::getModel('catalog/product')->loadByAttribute('sku',$sku);
$thumbnail = $productCollection->getThumbnailUrl();
$image = $productCollection->getImageUrl();
$smallimage = $productCollection->getSmallImageUrl();
$framedimages = $productCollection->getFramedImage();

print_r('THUMBNAIL: '.$thumbnail.'<br/>');      
print_r('Image: '.$image.'<br/>');              
print_r('Small Image: '.$smallimage.'<br/>');   
print_r('FramedImage: '.$framedimages.'<br/>'); 
  

输出:

THUMBNAIL: http://example.com/media/catalog/product/cache/1/thumbnail/75x75/9df78eab33525d08d6e5fb8d27136e95/3/0/30-4287_1.jpg

Image: http://example.com/media/catalog/product/cache/1/image/265x/9df78eab33525d08d6e5fb8d27136e95/3/0/30-4287_1_4.png

Small Image: http://example.com/media/catalog/product/cache/1/small_image/88x77/9df78eab33525d08d6e5fb8d27136e95/3/0/30-4287_1.jpg

FramedImage: /3/0/30-4287_2_3.png //仅这张图片质量低

0 个答案:

没有答案