I have been asked numerous times in the past how I create this effect in some forum signatures so now I am releasing the code so you can see. It could equally be used as a background image in CSS (like the photo of the excavator above) so you could have a circulating series of background or in this case header images. I am sure you can think of many other neat uses for this script.

refresh the page to see the above image change
Demo rar’d archive (includes demo ‘Disgraceful Alfa’ gallery images) can be found at the end of the article.
- Extract into a new directory
- Open image.jpg in your favourite editor
- Change the BASE_DIR to reflect the absolute path to the directory containing the image.php file eg. /home/simon/flickering/
- chmod the storage.dat file to 777
- Then open the url in your browser….enjoy!
This is the PHP script (image.jpg is the file name):
You also need to add a line to .htaccess:
ForceType application/x-httpd-php
Due to the change in the .htaccess file Apache now treats .jpg files as PHP in this directory. This then allows us to execute some php code which ultimately outputs a JPEG header and JPEG data, which shows up as an image when its linked to. The browser is none the wiser as it does not look like remote script invocation like some previous methods that have been released. So this can be used anywhere an image can without anyone knowing until they see it changing!
Comments powered by Disqus