How can the user ensure that the image is saved in the desired size of 160x120 pixels?

To ensure that the image is saved in the desired size of 160x120 pixels, the user can use PHP's image manipulation functions to resize the image before saving it. This can be done by opening the original image, creating a new image with the desired dimensions, and then copying and resizing the original image onto the new image. Finally, the new image can be saved in the desired size.

$originalImage = imagecreatefromjpeg('original.jpg');
$newImage = imagecreatetruecolor(160, 120);
imagecopyresampled($newImage, $originalImage, 0, 0, 0, 0, 160, 120, imagesx($originalImage), imagesy($originalImage));
imagejpeg($newImage, 'resized.jpg');
imagedestroy($originalImage);
imagedestroy($newImage);