Random image from directory.
PHP Python CSS Shell
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
css
fonts
i
img
README.md
image_index.py
image_index.sh
preview.png
random.php
random_v2.php
random_v3.php
template.php
wwwroot.htaccess

README.md

Image randomise FAQ

##Global settings##

  1. i/ - default image directory
  2. set execute-flag chmod +x image_index.sh or chmod +x image_index.py
  3. add image_index in crontab for autoindex image files
  4. put wwwroot.htaccess to www-root dir and rename to .htaccess
  5. ?????
  6. Nya~ ♥

##1. Raw-output version## Files: random.php, image_index.sh

random.php: path to image directory ($WWW_ROOT/i/ by default)

define('IMAGE_DIR', 'i/');

image_index.sh: needed full path to image directory

dir=/foo/bar

##2. Html-output version## Files: random_v2.php, image_index.sh, css/*, img/*

random_v2.php: path to image directory ($WWW_ROOT/i/ by default)

define('IMAGE_DIR', 'i/');

image_index.sh: needed full path to image directory

dir=/foo/bar

##3. Html-output version + short URL## Files: random_v3.php, template.php, image_index.py, wwwroot.htaccess, css/*, img/*

random_v3.php: path to sqlitedb file and template

$this->db = new PDO("sqlite:i/image_index.db");
...
require("./template.php");
...
$r = new RandomImage("./i/image_index.db");

template.php: change footer link

<div class="footer"> ... <a href="name" target="_blank">name</a></div>

image_index.py: path to image folder and db-file

images_dir = os.path.join(script_dir, "i")
db_file = os.path.join(images_dir, "image_index.db")

wwwroot.htaccess: edit RewriteRule

RewriteRule ^random~$ path_to_dir/random_v3.php [NC,L]
RewriteRule ^i/([\da-z]+)$ path_to_dir/random_v3.php?base62=$1 [NC,L]