Purpose of this script:
-----------------------
Read a RANDOM file in a RANDOM subdirectory and return this file (image in this specific case).
Example: Show a random image
Problem - or - why is this script needed
-----------------------------------------
There are about 60000 files in the subdirectories that are in our pool of possible files.
Other methods I found were not able to recreate this effect since the PHP execution time always ran out (or it produced memory problems).
This should be quite easy and fast.
Notes
-----
- Works best if an equal number of files is in each (sub) directory
- You can set the height_max and with_max to the screen resolution you are using. By doing this you will be able to see the complete image (when unsing the SuperBG or SuperSized2 CSS/JS script for example)
- Script was developped to run on a Synology DiskStation 209 using DiskStation Manager 2.3 with web enabled
- Used some functions from php.net, image.php is from
http://www.mawhorter.net/web-develo...flip-and-mirror-thumbnails-square-and-regular
- Rotation by exif does not work on my Synology as the php exif extension does not seem to be implemented
Files
-----
zufall10.php Call this in your browser for a slideshow (As always: IE = Not recommended)
zufall10.css css formating for the image - centered, black background...
dir-file-10.php Grabs a random file (image) from a random directory and returns this as a http stream content image
image.php nice image transformation functions (did a little change in there I believe)
Installation
------------
1. Extract all files into your webdirectoy
2. open "dir-file-10.php" and make adjustments in the settings area in the upper part of the file
Pay special attention to set the correct path to your images! This is relative!
The script files are residing on my Synology 209 in /web/slideshow, the images are in /photo, the setting looks like this:
$source_directory = '../../photo';
IF you are NOT using a Synology, you might want to look near line 160 for
$image = str_replace('../../','/volume1/',$image);
Here we create a systempath string to access the file directly! On my settings I was unable to use a relative path to the file!
3. Optional: You can change the switching interval for the images in file zufall10.php
Near line 31 search for
setInterval("count()",10000);
the 10000 is the time in miliseconds after which a new image should be shown.
Change this number to your liking, but let the server enough time to choose an image!
Example: In my setting, Synology DS209 with about 60000 images it could take up to 10 seconds to choose a file (add about another 10 seconds for transformation, depening on options) - to be on the save side.
4. open "zufall10.php" in your browser - you are DONE.