Jump to content
Sign in to follow this  

Web Based Script: Random Image

Recommended Posts

I was surfing for PHP scripts i could convert to work with Autoit Web-based. So i did this simple script. There's more detailed instructions on how to use it in the comments.

;Your total number of images
$total = "11"
;The file type?
$file_type = ".jpg"
;What folder are they in?
$image_folder = "/backgrounds/random/";

;Ok, so here's how you use it. Put images in the $image_folderyou defined. The number of images you put in
;depends on what you put for $total. Put that many images. All of the images must have the extension you
;put for $file_type


$start = "1";

$randm = Random($start, $total)
$random = Round($randm, 0)
$image_name = $random & "." & $file_type

Echo('<img src='&$image_folder & $random & $file_type) 

;The juicy part of the script is done now. Here are the functions that made it all possible

Func _StartWebApp ($Title="", $bkimage = "", $Color = "white")
    ConsoleWrite("Content-Type: text/html" & Chr(13) & Chr(10) & Chr(13) & Chr(10))
    If $title <> "" Then ConsoleWrite("<html><head><title>"&$title&"</title></head><body bgcolor ="&$color&">")
    If $bkimage <> "" then ConsoleWrite("<html><head><title>"&$title&"</title></head><body background="&$bkimage&">")
Func echo($text)

;Now... the script is finished.

Doesn't require web.au3 because i put the required functions inside the script.



Edited by D-Generation X

Share this post

Link to post
Share on other sites

Ok, I got another challenge for ya. Completely take out $total and have the script search $image_folder for all files with the extension $file_type. That way, people can choose their own name instead of 1.jpg, 2.jpg, etc, and they could use as many as they want without having to go in and change $total every time.

The cake is a lie.www.theguy0000.com is currentlyUP images.theguy0000.com is currentlyUP all other *.theguy0000.com sites are DOWN

Share this post

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

  • Create New...