What is the recommended way to copy an image file and rename it using PHP?

To copy an image file and rename it using PHP, you can use the `copy()` function to duplicate the file and then use the `rename()` function to change its name. This can be useful when you want to create a backup of an image file or save it with a different name.

$fileToCopy = 'original_image.jpg';
$newFileName = 'new_image.jpg';

// Copy the file
if (copy($fileToCopy, $newFileName)) {
    echo "File copied successfully.";
} else {
    echo "Failed to copy file.";
}

// Rename the copied file
if (rename($newFileName, 'renamed_image.jpg')) {
    echo "File renamed successfully.";
} else {
    echo "Failed to rename file.";
}