The best solution would be to setup a cron job that runs every night, that copies the fullsize image + thumbnails from a private directory to a public directory. So, you name your images 1-31.jpg (or 1-365.jpg), thumbnails like tn[1-31]_widthxheight.jpg. The last thing you want to do is have a bunch of php code running over and over again for an image load (especially if you are determining which thumbnail to load via php)
so,
PHP Code:
<?php
// get the day of the month
$today = date("d");
// copy the fullsize image and name it as image.jpg
copy("/blah/privatepath/".$today.".jpg","/blah/publicpath/image.jpg");
// repeat the following for each thumbnail
copy("/blah/privatepath/tn".$today."_88x88.jpg","/blah/publicpath/tn_88x88.jpg");
?>
So now, your potd html page can just link to image.jpg (no php needed) + your affiliates can link to tn_88x88.jpg without linking to a php page to load a thumbnail...