As per this post dated back from 2015, there is an issue with Github caching images you've embedded in markdown, eg README.md files.
This script is a PHP cron that accepts an array of images & clears their cache.
It should be run at a fairly sensible interval that clears the cache of the image(s) you've specified.
Upload this to a PHP server, then just hit the URL of the file you've created.
To automate this, most hosting providers offer a cron solution. Simply curl to this file on your server, eg curl "https://YOUR_SERVER.com/PATH/TO/THIS_FILE.php"
. Example cron interval 0 4 * * *
(04:00 every day).
// Show all PHP errors.
ini_set('display_errors', 1);
ini_set('display_startup_errors', 1);
error_reporting(E_ALL);
// Array of images.
$images = [
'https://camo.githubusercontent.com/...', // Update this to your image(s).
];
// Loop over each image.
foreach ($images as $image) {
echo clearCache($image);
echo "\n\n";
}
// Output done.
echo "\n\n== All done ==";
/**
* Function to clear the cache for a given image URL.
* @param $image
* @return response from curl request
*/
function clearCache($image) {
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => $image,
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => '',
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 0,
CURLOPT_FOLLOWLOCATION => true,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => 'PURGE',
]);
$response = curl_exec($curl);
curl_close($curl);
return $response;
}