Looking at Mage_Catalog_Helper_Image->resize
/**
* Schedule resize of the image
* $width *or* $height can be null - in this case, lacking dimension will be calculated.
*
* @see Mage_Catalog_Model_Product_Image
* @param int $width
* @param int $height
* @return Mage_Catalog_Helper_Image
*/
public function resize($width, $height = null)
{
$this->_getModel()->setWidth($width)->setHeight($height);
$this->_scheduleResize = true;
return $this;
}
So resize by ->keepFrame(true)->resize(null, 300)
You can do that via the menu Catalog > Attributes > Manage Attributes and creating an attribute with a Dropdown type.
After that, you can add it to the attribute set of your choice in Catalog > Attributes > Manage Attribute Sets. Select your Set, then drag your attribute in the right column, and drop it in the left one, under the group "Images". Your attribute should then display in "Manage Products".
If you want to add this attribute programmatically, you can do it with an installer, and a code like that :
<?php
$installer = $this;
$installer->startSetup();
// Group : General
$attributeSetDefault = 'Default';
$attributeGroup = 'Images';
$attributeSetId = $installer->getAttributeSetId('catalog_product', $attributeSetDefault);
if($attributeSetId){
$attributeGroupId = $installer->getAttributeGroupId('catalog_product', $attributeSetId, $attributeGroup);
}
// Attribute : attribute_code
$attributeCode = 'attribute_code';
$attribute = $installer->getAttribute('catalog_product', $attributeCode);
if (empty($attribute['attribute_id'])) {
$options = array();
$options['value']['option0'][0] = 'Option 0';
$options['value']['option1'][0] = 'Option 1';
$installer->addAttribute(
'catalog_product',
$attributeCode,
array(
'label' => 'Attribute',
'type' => 'varchar',
'backend' => 'eav/entity_attribute_backend_array',
'frontend' => '',
'input' => 'select',
'frontend_class' => '',
'source' => '',
'required' => false,
'user_defined' => true,
'default' => '',
'unique' => false,
'global' => Mage_Catalog_Model_Resource_Eav_Attribute::SCOPE_GLOBAL,
'option' => $options,
)
);
$attributeId = $installer->getAttributeId('catalog_product', $attributeCode);
if($attributeGroupId && $attributeId){
$installer->addAttributeToGroup('catalog_product', $attributeSetId, $attributeGroupId, $attributeId);
}
}
$installer->endSetup();
Best Answer
You can define the base product image dimensions in config -> catalog -> product image.
I expect it would be possible to write a custom module to further perform image resizing but it would be simpler to either create your images in the format you want or use a free image editing package (such as IrfanView) to bulk modify the images you want to use before you upload them.