Magento: Category Image Re-size

We don't have any function to re-size the category image, but we can use this code for category image resize

[php]
$_category=Mage::getModel('catalog/category')->load($categoryId());
$_imgUrl = $_category->getResizedImage(70,70);
[/php]

and extend category model to your local system or your custom module
XML

[html]

<code><global>
<models>
<catalog>
<rewrite>
<category>NameSpace_Modulename_Model_Category</category>
</rewrite>
</catalog>
</models>
</global></code>

[/html]

in side model folder add this file Category.php and paste this code

return false;

[php]

$imageUrl = Mage::getBaseDir ( 'media' ) . DS . "catalog" . DS . "category" . DS . $this->getImage ();
if (! is_file ( $imageUrl ))
return false;

$imageResized = Mage::getBaseDir ( 'media' ) . DS . "catalog" . DS . "product" . DS . "cache" . DS . "cat_resized" . DS . $this->getImage ();// Because clean Image cache function works in this folder only
if (! file_exists ( $imageResized ) && file_exists ( $imageUrl ) || file_exists($imageUrl) && filemtime($imageUrl) > filemtime($imageResized)) :
$imageObj = new Varien_Image ( $imageUrl );
$imageObj->constrainOnly ( true );
$imageObj->keepAspectRatio ( true );
$imageObj->keepFrame ( false );
$imageObj->quality ( $quality );
$imageObj->resize ( $width, $height );
$imageObj->save ( $imageResized );
endif;

if(file_exists($imageResized)){
return Mage::getBaseUrl ( 'media' ) ."/catalog/product/cache/cat_resized/" . $this->getImage ();
}else{
return $this->getImageUrl();
}

}

}

[/php]