Improve code to download and cache Gravatar images
A PHP script
host_image.php is used to search for a Gravatar per host and download it if found to the server. The HPR episode and host display code uses this cache to show host images.
In recent time the
crontab entry for this script was disabled because it began to misbehave. This meant that new hosts with Gravatars were not seeing their images on their show pages.
Initial investigation showed that the script was using an URL of the form:
where it should have been:
The effect of the bad URL seems to have been that the request returned the default Gravatar (a rotated letter 'G' on a blue background) when the host did not have an image. When the correct URL was used requests for non-existent URLs got a 404 error as intended.
An alternative script
host_image_new.php was created with the corrected URL and it refreshed the cache successfully.
The original script needs to be reviewed and possibly rewritten. It uses:
which generates many warnings.