Originally published at Random Geekage You can comment here or there.
A nice wee gem that Alex Peake informed me was possible. The problem: you want a randomly chosen image as a background but don’t want duplication in your css.
In your css file:
background-image: url('images/background.php');
Create the file referenced above with this code:
<?php
$numofimages = count(glob("*.jpg"));
$imagenum = rand(1, $numofimages);
header("Content-Type: image/jpeg\n");
header("Content-Transfer-Encoding: binary");
$fp=fopen("headerimage". $imagenum .".jpg" , "r");
fpassthru($fp);
?>
and voila, random images as a background with the bonus of being able to throw in a new image without having to do any more coding.
This code assumes that your images are called headerimageX.jpg where X is a number.
Originally published at Random Geekage You can comment here or there.
Update 06/10/08: Got it sorted
CSS is a pain in the ass sometimes. Everything seems to be fine yet the main content is appearing below my sidebar instead of side by side. I am told that this is because one element is probably too big and is being pushed out of alignment. My sidebar is 200 pixels with a 600 pixel left margin and floated right. The content is 600 pixels wide with a 200 pixel right margin and is floated left.
This is why I’ll never be a web developer.
