I was struggling long for proper image resize function for maintaining image ratio.
Finally i end end up with merging and changing all codes and it works !
function resizeImage($sourceFile,$destFile,$width,$height)
sourceFile => Full path along with filename
destinationFile => Full path along with filename
I hope this will help coders..