简体   繁体   English

在magento产品视图中调整图像大小

[英]Resize image in magento product view

Want to increase the size of an image on the Product view page in Magento 1.8 CE, Modern theme. 想要在Magento 1.8 CE(现代主题)的“产品”视图页面上增加图像的大小。 I tried to change the values from 265 to 400 in the following files: 我试图将以下文件中的值从265更改为400:

/app/design/frontend/default/modern/template/catalog/product/view/media.phtml

/app/design/frontend/base/default/template/catalog/product/view/media.phtml

/app/design/frontend/default/default/template/featurezoom/media.phtml 

(because this extension was installed. I have a feeling that the problem might be here, but cannot find what) (因为已安装此扩展程序。我觉得问题可能在这里,但找不到什么)

/app/design/frontend/base/default/template/productdetails/media.phtml

even in the /app/code/core/Mage/Catalog/Model/Product.php 即使在/app/code/core/Mage/Catalog/Model/Product.php

Changed the css file .product-view .product-img-box .product-image {width: 400px} 更改了CSS文件.product-view .product-img-box .product-image {width: 400px}

Flushed the cache, cleared the folder /media/catalog/product/cache/ 清除缓存,清除文件夹/media/catalog/product/cache/

But something still keeps creating the 265x265 folder in the cache 但是仍然有一些东西继续在缓存中创建265x265文件夹

Here is the page 这是页面

Thought it would be simple task, but already spent the entire day on it. 认为这将是一项简单的任务,但已经花了一整天了。

Any help is appreciated 任何帮助表示赞赏

So I believe I found the solution. 所以我相信我找到了解决方案。 Thanks Nikitas for the suggestion to use the debug mode. 感谢Nikitas关于使用调试模式的建议。 Not sure if this is proper way, but this works. 不知道这是否是正确的方法,但是可以。 The file I edited was frontend/base/default/template/productdetails/media.phtml Initial code was 我编辑的文件是frontend / base / default / template / productdetails / media.phtml初始代码是

/* Main Image Size */
if (strstr($_productDetails['mainImageSize'], '_')) {
    $mainImageSize = explode('_', $_productDetails['mainImageSize'], 2);
} else {
    $mainImageSize = array(265, 265);
}

Changing the sizes in the ELSE didn't help, so I changed it in the IF statement like this 在ELSE中更改大小无济于事,因此我在IF语句中这样更改了它

/* Main Image Size */
    if (strstr($_productDetails['mainImageSize'], '_')) {
/*         $mainImageSize = explode('_', $_productDetails['mainImageSize'], 2); */
        $mainImageSize = array(400, 400);
    } else {
        $mainImageSize = array(265, 265);
    }

If you know better solution or have any suggestions, that would be helpful. 如果您知道更好的解决方案或有任何建议,那将有所帮助。 Thanks 谢谢

Now I'll have to play with the zoom because it increased the zoom box 现在,我必须使用缩放,因为它增加了缩放框

Just go to 只是去

/app/design/frontend/yourtheme/default/template/catalog/product/view/media.phtml

Find the code 查找代码

'image')->resize(436)

and just give your image dimension in here like 然后在这里给你的图像尺寸

'image')->resize(300,436)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM