Alrighty. I have a camera watch, and I post the various camera watch pictures on the frontpage of my website, PatTheGreat.com. However, my current watch picture collection is about 10 megs, and I don't want people downloading 10 megs of stuff every time they visit ye old site.
The solution? Have random.org spit out a random sequence, and then pick the first 99 numbers. This is the easy part.
Once I get the numbers, I format them into a three-digit string so they work as URLS for the pics, and then I paste them together into a string for the URL. Here is the code (And it's not very dense because I've been working on this and am trying to figure out what's wrong):
I've got this all in a while loop that dies when $i hits 98, and $sequence is the array with the random sequence. Anyways, I figure if, for example, $sequence[$1] == 24, it should spit out "<img src=watchpictures/Pict024.JPG>"
However, when I go to the source of the produced page, I get "watchpictures/Pict656".
Any thoughts?
The solution? Have random.org spit out a random sequence, and then pick the first 99 numbers. This is the easy part.
Once I get the numbers, I format them into a three-digit string so they work as URLS for the pics, and then I paste them together into a string for the URL. Here is the code (And it's not very dense because I've been working on this and am trying to figure out what's wrong):
| Code: |
| $pic = substr("000",strlen($sequence[$i]) - 1).$sequence[$i];
$i++; $url = "<img src=watchpictures/Pict".$pic.".JPG>"; |
I've got this all in a while loop that dies when $i hits 98, and $sequence is the array with the random sequence. Anyways, I figure if, for example, $sequence[$1] == 24, it should spit out "<img src=watchpictures/Pict024.JPG>"
However, when I go to the source of the produced page, I get "watchpictures/Pict656".
Any thoughts?
