Changing the resolution of the photo in PHP

I have a code that uploads the picture to the server.

$image_name = time() . '_' . $_FILES['image']['name'];
$destination = "C:/xampp/htdocs/blog/media/images/" . $image_name;
move_uploaded_file($_FILES['image']['tmp_name'], $destination);

The uploaded picture will serve as a thumbnail for the post. What should be done to make PHP change the resolution of this photo to e.g. 144px x 144px without stretching it etc. before uploading this photo?

EDIT: I'm totally beginner. I added this code, and it's not working, and return error: Fatal error: Uncaught Error: Call to undefined function imagecreatefromjpg() in C:\xampp\htdocs\blog\admin\posts\create.php:7 Stack trace: #0 {main} thrown in C:\xampp\htdocs\blog\admin\posts\create.php on line 7

    $filename = "C:/xampp/htdocs/blog/media/images/1596999450_rubber-plant.jpg";
    $original_info = getimagesize($filename);
    $original_w = $original_info[0];
    $original_h = $original_info[1];
    $original_img = imagecreatefromjpg($filename);
    $thumb_w = 100;
    $thumb_h = 100;
    $thumb_img = imagecreatetruecolor($thumb_w, $thumb_h);
    imagecopyresampled($thumb_img, $original_img,
                    0, 0,
                    0, 0,
                    $thumb_w, $thumb_h,
                    $original_w, $original_h);
    imagejpeg($thumb_img, $thumb_filename);