Jak zmienić rozmiar obrazka w PHP?

$oldFile = "testpicture.jpg";
$newFile = "NEW_testpicture.jpg";
$percent = 0.5;

list($width, $height) = getimagesize($oldFile);
$newWidth = $width * $percent;
$newHeight = $height * $percent;

$thumb = imagecreatetruecolor($newWidth, $newHeight);
$source = imagecreatefromjpeg($oldFile);
	
imagecopyresized($thumb, $source, 0, 0, 0, 0, $newWidth, $newHeight, $width, $height);

imagejpeg($thumb, $newFile);