try following for resizing the image:
getData();
$uploadedFile = $data['profielfoto'];
// get the original file info
$originalPath = $uploadedFile['tmp_name'];
$originalName = $uploadedFile['name'];
$targetDirectory = dirname($originalPath); // original dir
// create new filename
$info = pathinfo($originalName);
$resizedFilename = $info['filename'] . '_resized.' . $info['extension'];
$resizedPath = $targetDirectory . "https://stackoverflow.com/" . $resizedFilename;
// get dimensions from uploaded img
list($originalWidth, $originalHeight) = getimagesize($originalPath);
// calculate new dimensions
$percent = 0.5; // that would be 50% percent of the original size
$newWidth = $originalWidth * $percent;
$newHeight = $originalHeight * $percent;
$originalImage = imagecreatefromjpeg($originalPath);
$resizedImage = imagecreatetruecolor($newWidth, $newHeight);
// resize and save
imagecopyresampled($resizedImage, $originalImage, 0, 0, 0, 0, $newWidth, $newHeight, $originalWidth, $originalHeight);
imagejpeg($resizedImage, $resizedPath, 90); // 90 is quality (0-100)
// free up your memory
imagedestroy($originalImage);
imagedestroy($resizedImage);
// now $resizedPath should contain the path to the resized image
or if you want to crop the image heres some code for that too:
(used from my project and modified)
i hope that works for your code but please double check