Magento – how to resized image in magento

///////////////////// image resize start ///////////////
$imageUrl = Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_MEDIA).”contact/”.$imageFile;
$imageName = substr(strrchr($imageUrl,”/”),1);
$imageResized = Mage::getBaseDir(‘media’).DS.”contact”.DS.”resized”.DS.$imageName;
// changing image url into direct path
$dirImg = Mage::getBaseDir().str_replace(“/”,DS,strstr($imageUrl,’/media’));
// if resized image doesn’t exist, save the resized image to the resized directory
if(!file_exists($imageResized) && file_exists($dirImg)) :
$imageObj = new Varien_Image($dirImg);
$imageObj->constrainOnly(TRUE);
$imageObj->keepAspectRatio(FALSE);
$imageObj->keepFrame(FALSE);
$imageObj->resize(120, 120);
$imageObj->save($imageResized);
endif;
///////////////////// image resize enf ///////////////