Maintain aspect ratio of image while uploading

excatmexy9997

New Member
I am uploading image with PHP.During upload i am resizing image from actual image to needed size.But image size in not getting in its aspect ration according to width.PHP Code.\[code\]$size = getimagesize($_FILES["file"]["tmp_name"]);$ratio = $size[0]/$size[1];$req_width = 500;$height = $req_width* $ratio*2;//after this code for re-size image with above dimension and upload image code.\[/code\]What i am doing wrong in formula.
 
Top