rejetto forum

random pics folder

0 Members and 1 Guest are viewing this topic.

Offline moondog

  • Occasional poster
  • *
    • Posts: 67
    • View Profile
Easy step by step

Step 1: Create a folder or directory called randompics.

Step 2: put pictures into the randompics director and name them "pic1.jpg", "pic2.jpg", "pic3.jpg", "pic4.jpg", and "pic5.jpg". (note: you can do as mainy as you wish  keep reading thow how to edit)

Step 3: put the folder in your hfs.

Step 4: Copy the lines below as you will need it in a few mins


<html>
<head>
<script language="JavaScript">
<!-- Hide this script from old browsers --
var random = Math.random() ;
var picnum = Math.round(random*4)+1;
// -- End Hiding Here -->
</script>
</head>
<body bgcolor="#FFFFFF">
<center>
<br>
Hit Reload to see another picture!
<br>
<script language="JavaScript">
<!-- Hide this script from old browsers --
document.write('<img src=pic'+picnum+'.jpg>')
document.write('<br>')
document.write('picture number = '+picnum)
// -- End Hiding Here -->
</script>
<br>
Hit Reload to see another picture!
</center>
</body>
</html>


Step 4: Now click on your folder in HFS and go to advance. Then go to Diff template past what u just copyed. and test

Step 5: Ie might give you a notice that blocking pop ups. Not sure how to fix hope this helps u all

Note: You may edit the ranpic.html page as you desire. You can change the number of images by changing the number in the line that reads, "var picnum = Math.round(random*4)+1". Be sure to make the number (currently 4) one less than the number of images you put in the directory.


Offline moondog

  • Occasional poster
  • *
    • Posts: 67
    • View Profile
I used Batch Images Now to do my pics for me and its free


Offline rejetto

  • Administrator
  • Tireless poster
  • *****
    • Posts: 13510
    • View Profile
with macros, in version 2.3 beta, this would be

<img src=pic{{random{{for|x|1|4|{{\|{{^x}}/}}/for}}/random}}.jpg>

with no javascript :)
sadly, because of a bug, this code won't work till the next build is published.

Moreover, next build will have a new macro 'random number' that will make things easier

<img src=pic{{random number|1|4}}.jpg>
« Last Edit: January 18, 2008, 05:45:53 AM by rejetto »