and # # RANDOM BACKGROUND IMAGE # 1. Load a plain text file of URLs of images into an array. # Give $bgfilename the relative URI of your list, # e.g. $bgfilename = "mylist.txt" # this is pre-set to work at timil.com/php $bgfilename = $root . "random-background-image/bg-pics.txt"; $pictures = file($bgfilename, FILE_IGNORE_NEW_LINES); # 2. pick a random one $bg_pic = $pictures[mt_rand(0, count($pictures) - 1)]; # 3. write the CSS print("body { \n"); print("background-image:url('$bg_pic'); \n"); print("background-size: cover;\n"); print("} \n"); ?>