I am uploading image in php, while uploading i want to resize image in four pixel(800\*700, 620\*310, etc...).For this i tried below code, in that i am getting image with exact pixel but i am getting bad image quality. its not resizing with quality, i have attached my code below please help me to solve this 
Thank you

PHP:

```
if(isset($_FILES['file_img']['name']))
    {
        for($i=0; $i<count($_FILES['file_img']['name']); $i++) 
        {
               $tmpFilePath = $_FILES['file_img']['tmp_name'][$i];
               if ($tmpFilePath != "")
               {    
                   $path = "floorplan/"; // create folder 
                   $floorPlanName = $_POST['file_name'][$i];
                   $name = $_FILES['file_img']['name'][$i];
                   $filename = stripslashes($_FILES['file_img']['name'][$i]);
                    $extension = getExtension($filename);
                    $extension = strtolower($extension);

                    if($extension=="jpg" || $extension=="jpeg" )
                    {
                    $src = imagecreatefromjpeg($tmpFilePath);
                    }

                    else 
                    {
                    $src = imagecreatefromgif($tmpFilePath);
                    }
                    list($width,$height)=getimagesize($tmpFilePath);

                    $newwidth=1000;
                    $newheight=($height/$width)*$newwidth;
                    $tmp=imagecreatetruecolor($newwidth,$newheight);

                    $newwidth2=312;
                    $newheight2=209;
                    $tmp1=imagecreatetruecolor($newwidth2,$newheight2);

                    imagecopyresampled($tmp,$src,0,0,0,0,$newwidth,$newheight,$width,$height);

                    imagecopyresampled($tmp1,$src,0,0,0,0,$newwidth2,$newheight2,$width,$height);

                    $filename = "floorplan/".$_FILES['file_img']['name'][$i];

                    $filename1 = "floorplan/vs". $_FILES['file_img']['name'][$i];

                    imagejpeg($tmp,$filename,100);

                    imagejpeg($tmp1,$filename1,100);

                    imagedestroy($src);
                    imagedestroy($tmp);
                    imagedestroy($tmp1);

                    $paname = $filename;

                   if(move_uploaded_file($_FILES['file_img']['tmp_name'][$i], $filename)) 
                   { 
                    $query=mysql_query("INSERT INTO `floor_plan` (project_id, floorplan_name, floorplan_img, vs_img, created_on) VALUES('$getId', '$floorPlanName', '$paname', '$filename1', '$createdOn' )");
                   }
             }
        }

    }

```

HTML:

```
<div class="col-md-8">
                            <div class="form-group">
                                <label>Choose file</label>
                                <input name="file_img[]" id="floorplanId" type="file" data-change="floorEvent" style="margin-top: 8px;" multiple>
                                <small class="text-danger">Note: Upload files like jpg formate</small>
                                <output id="result" />
                                <!-- <div id="remove1"></div> -->
                            </div>
                            </div>

```

While use this code my image quality get damage. please give some idea frndz