|
This is how I fixed the image scaling problem in my Magento 1.0 installation. This solution is based on what I have read by others in this thread. Thank you to them! I’m hoping the fine level of detail I’ve put down here will assist those new to Magento (and who isn’t new to Magento?!!!).
Before uploading these changed files, consider making backups or renaming the live files on your server with the file extension .bak instead of overwriting.
1. To change the dimensions of the 135x135 pixel image displayed for Simple Products and Grouped Products (and I’m guessing also Configurable Products) I needed to edit this file:
app/design/frontend/default/default/template/catalog/product/list.phtml
Line 45 reads:
<img src="<?php echo $this->helper('catalog/image')->init($_product, 'small_image')->resize(135, 135); ?>" width="135" height="135" alt="<?php echo $this->htmlEscape($_product->getName()) ?>"/>
I found that changing the height value to 0 was a bad idea (not to mention the other reasons not to do this mentioned in this thread) so I chose 64 for my height:
<img src="<?php echo $this->helper('catalog/image')->init($_product, 'small_image')->resize(135, 64); ?>" width="135" height="64" alt="<?php echo $this->htmlEscape($_product->getName()) ?>"/>
Line 93 is very similar and reads:
<img src="<?php echo $this->helper('catalog/image')->init($_product, 'small_image')->resize(135, 135); ?>" width="135" height="135" alt="<?php echo $this->htmlEscape($_product->getName()) ?>"/> </a>
I changed line 93 to:
<img src="<?php echo $this->helper('catalog/image')->init($_product, 'small_image')->resize(135, 64); ?>" width="135" height="64" alt="<?php echo $this->htmlEscape($_product->getName()) ?>"/> </a>
2. To change the dimensions of the 68x68 pixel image displayed under the ‘More Views’ heading on a Simple Products or Grouped Products page (and I’m guessing also a Configurable Products page) you need to edit this file:
app/design/frontend/default/default/template/catalog/product/view/media.html
Line 54 reads:
<img src="<?php echo $this->helper('catalog/image')->init($this->getProduct(), 'thumbnail', $_image->getFile())->resize(68, 68); ?>" width="68" height="68" alt="<?php echo $this->htmlEscape($_image->getLabel()) ?>" title="<?php echo $this->htmlEscape($_image->getLabel()) ?>"/>
Again, I chose to set an actual height value, so mine read:
<img src="<?php echo $this->helper('catalog/image')->init($this->getProduct(), 'thumbnail', $_image->getFile())->resize(68, 32); ?>" width="68" height="32" alt="<?php echo $this->htmlEscape($_image->getLabel()) ?>" title="<?php echo $this->htmlEscape($_image->getLabel()) ?>"/>
|