Server Time:
Thursday May 22 2008 02:18 PM  
Your Time:
  
HostMySite.Com is sponsoring this tutorial, please visit their site today!
This tutorial is sponsored by HostMySite.Com - ColdFusion Hosting

Another Random Image Selector
by: Bobby Hartsfield
Email this tutorial to a friend Display Printer Friendly Format
[Download in PDF Format] [Download in FlashPaper Format]

The first thing we need to do is to define the save file path and the web path to the "myimages" folder which we will later query for the files.

<cfset imagepath = "C:\webroot\myimages">
<cfset imageURL =
"http://myserver/myimages">


<!--- first get a list of all jpg's in your image directory --->
<cfdirectory action="LIST" directory="#imagepath#" filter="*.jpg" name="homeimages">

<!--- This variable will hold a comma delimited list of all the jpg's found in the directory --->
<cfparam name="imglist" default="">
<cfloop query=
"homeimages">
    <cfset imglist = listappend(imglist, name,
",")>
</cfloop>


<!--- "ThisImage" is this rounds random image file --->
<cfset thisimage = listgetat(imglist, randrange(1, listlen(imglist)))>

<cfoutput>
    <img src="#imageURL#/#ThisImage#">
</cfoutput>

<!--- hope someone can use it and as always... Have fun! --->


Date added: Tue. August 12, 2003
Posted by: Bobby Hartsfield | Views: 9425 | Tested Platforms: CF4,CF5 | Difficulty: Intermediate
Categories Listed: Other

HostMySite.Com is sponsoring this tutorial, please visit their site today!
This tutorial is sponsored by HostMySite.Com - ColdFusion Hosting

This author's other tutorials:
A Basic Calendar Application to Build on
I have seen quite a few people looking for prebuilt calendar apps but the people I wrote this for are the people who wanted a headstart in building their OWN custom calendar app. It is very basic and does nothing more than display the currently selected month/year's calendar and give links to the PREVIOUS the NEXT month's calendars by using The DateAdd() function. Basically the backbone of any calendar app. Enjoy. and as Always.. HAVE FUN! - Date added: Fri. August 15, 2003
Random String/Password Generation
This is a custom tag I wrote that generates a random string at the set number of characters using the characters you decide on Alpha AlphaNumeric or Numeric Uppercase, lowercase, mixed case... It will create a variable that you name as you wish and call however you'd like. It is a small example of how to create a custom tag and will hopefully send someone in the right direction. It is also fully functional and has come in handy quite a few times. Enjoy and as always.. Have Fun! - Date added: Tue. August 12, 2003
Please rate this tutorial:
5 Stars 4 Stars 3 Stars 2 Stars 1 Stars
Post a new comment on this tutorial
post a new comment on this particular tutorial
Your Name:
Your Email:
Comment Title:
Comments:
Key Phrase:
 
Skyscrapper Banner Advertisement
CF 8 Hosting for less then $40 a year!

You are 1 of 357 active sessions! | Privacy | Company
Copyright © 2002 EasyCFM.Com, LLC. (Easy ColdFusion Tutorials) All Rights Reserved (Server: www0002)
All other trademarks and copyrights are the property of their respective holders.
ColdFusion Hosting ColdFusion Hosting
ADD TO:
Blink
Del.icio.us
Digg
Furl
Google
Simpy
Spurl
Y! MyWeb