This hack uses a bash­script and apache’s time depen­dent rewrit­ing func­tion to deliver a ran­dom image directly from a direc­tory, no php, no noth­ing. This way you can embed a sim­ple image link http://path/to/random.jpg and for each sec­ond a dif­fer­ent image from a folder will be used, so every page vis­i­tor gets a ran­dom image.

echo RewriteEngine on > $ACCESSFILE echo RewriteRule ^random.jpg\$ %\{TIME_SEC\}.jpg >> $ACCESSFILE echo >> $ACCESSFILE
while [ $COUNT -le 60 ] do FILE=`ls $FOLDER/*.jpg | rl --count=1` SEC=`echo 0$COUNT | rev | cut -c 1-2 | rev` echo RewriteRule \^$SEC.jpg\$ $URL${FILE##*/} >> $ACCESSFILE COUNT=`expr $COUNT + 1` done
exit 0;

This pro­duces an .htac­cess file that looks like this:

RewriteEngine on
RewriteRule ^random.jpg$ %{TIME_SEC}.jpg
RewriteRule ^00.jpg$ Offener_Schaltkreis_Preview-07.jpg RewriteRule ^01.jpg$ Offener_Schaltkreis_Preview-09.jpg RewriteRule ^02.jpg$ Offener_Schaltkreis_Preview-02.jpg RewriteRule ^03.jpg$ Offener_Schaltkreis_Preview-17.jpg RewriteRule ^04.jpg$ Offener_Schaltkreis_Preview-01.jpg
RewriteRule ^59.jpg$ Offener_Schaltkreis_Preview-01.jpg RewriteRule ^60.jpg$ Offener_Schaltkreis_Preview-07.jpg
Test it with refresh !!!