What is the best way to display an email address as an image in PHP to prevent direct copying?

To prevent direct copying of an email address, one way to display it as an image in PHP. This can help protect the email address from being easily harvested by bots or spammers. By converting the email address into an image, it makes it more difficult for automated programs to extract the email address directly from the webpage's source code.

<?php
$email = 'example@example.com';
$size = 12;
$image = imagecreate($size*strlen($email), $size);
$background = imagecolorallocate($image, 255, 255, 255);
$textcolor = imagecolorallocate($image, 0, 0, 0);
imagestring($image, 5, 0, 0, $email, $textcolor);
header('Content-Type: image/png');
imagepng($image);
imagedestroy($image);
?>