You don't need a cronjob, you can use the time()
function and use the mod
power for shift the images seen every 12 hours.
Try this script
$now = time(); // you can simulate adding 12 hours +3600*12
$base = round( $now/(3600*12) ); // this number change every 12 hours
$n_images = 20; // number of your images
$start_from = $base % $n_images; // start from $start_from image
// loop for get your 4 images (3,4,5,6 or 4,5,6,7 or ,18,19,20,1,2 etc.)
for($i = 0; $i < 4; $i++) {
$image = ($start_from+$i) % $n_images + 1;
echo "get image " . $image.".jpg<br/>";
}