Magento – How to resize the header logo of magento

magento-1.7

How to resize the header logo of magento??
Please reply soon.. I am Working now

<img src="<?php echo $this->getLogoSrc()->resize() ?>" alt="<?php echo $this->getLogoAlt() ?>" />

Best Answer

The best way to resize an image in magento isVarien_Image

Follow the below code for resize image
$image = new Varien_Image('/full/fs/path/to/image.jpg');

// you cannot use method chaining with Varien_Image
$image->constrainOnly(false);
$image->keepFrame(true);
// avoid black borders by setting background colour
$image->backgroundColor(array(255,255,255));
$image->keepAspectRatio(true);
$image->resize(216, 139);
$image->save('/full/fs/path/to/save/to.jpg');

more clearly

$_imageUrl = logo die path;
$imageResized = Mage::getBaseDir(‘media’).DS.“resized”.$image;
if (!file_exists($imageResized)&&file_exists($_imageUrl)) :
$imageObj = new Varien_Image($_imageUrl);
$imageObj->constrainOnly(TRUE);
$imageObj->keepAspectRatio(TRUE);
$imageObj->keepFrame(FALSE);
$imageObj->resize(140, 140);
$imageObj->save($imageResized);
endif;