<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>dingobytes &#187; turorial</title>
	<atom:link href="http://www.dingobytes.com/tag/turorial/feed" rel="self" type="application/rss+xml" />
	<link>http://www.dingobytes.com</link>
	<description>what your nephew can't make you</description>
	<lastBuildDate>Tue, 17 Jan 2012 22:24:10 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>Coldfusion Image Rotator</title>
		<link>http://www.dingobytes.com/coldfusion/coldfusion-image-rotator</link>
		<comments>http://www.dingobytes.com/coldfusion/coldfusion-image-rotator#comments</comments>
		<pubDate>Mon, 03 Mar 2008 19:15:01 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Coldfusion]]></category>
		<category><![CDATA[image]]></category>
		<category><![CDATA[rotator]]></category>
		<category><![CDATA[turorial]]></category>

		<guid isPermaLink="false">http://www.dingobytes.com/2008/03/03/coldfusion-image-rotator/</guid>
		<description><![CDATA[I was tasked a few months ago to rotate an image on a site randomly. Ordinarily this would not be an issue but the image was a css background image and I really didn't have the ambition to rewrite the css and page html to do this. Thankfully my laziness paid off, because I found a solution while looking through some php code for wordpress.]]></description>
			<content:encoded><![CDATA[<p>I was tasked a few months ago to rotate an image on a site randomly. Ordinarily this would not be an issue but the image was a css background image and I really didn&#8217;t have the ambition to rewrite the css and page html to do this. Thankfully my laziness paid off, because I found a solution while looking through some php code for wordpress.</p>
<p>I ran into this template that I liked, but wanted to change the header image. I changed it, uploaded it and refreshed the page, but NOTHING changed. I spent a good 5 minutes on this before checking the css to see what was going on. Instead of finding a path to an image in the css for the background, I found a path to a file named rotate.php. The script was written by Matt Mullenweg (<a href="http://photomatt.net/scripts/randomimage">http://photomatt.net/scripts/randomimage</a>) and seemed simple enough to me. What I liked about this script is that it didn&#8217;t require managing a bunch of images. If you want an image you simply stick it in a predefined directory and point to that directory.</p>
<p>I decided to rewrite this in coldfusion and within a few minutes I had a working. It is rather simple. Define your folder, define your extensions and define the url path to the folder and you are done. You will find the code below.</p>
<pre class="brush: coldfusion; title: ; notranslate">
&lt;cftry&gt;
&lt;!---
created by Andrew Alba &gt;&gt; http://www.albawebstudio.com
This will grab images from specified folder and randomly display them. You will only need to modify the three variables below
---&gt;
&lt;!--- Insert the absolute path (with trailing slash) to the images.
&quot;/home/mysite/public_html/images/&quot; or &quot;/www/mysite/web/images/random/&quot;
If the images are in the same directory as this script you can leave it as shown file
---&gt;
	&lt;cfset folder = &quot;#GetDirectoryFromPath(GetBaseTemplatePath())#&quot; /&gt;
	&lt;!--- List of allowed extensions (separate with space) ---&gt;
	&lt;cfset ext = &quot;jpg jpeg png gif&quot; /&gt;
	&lt;!--- Insert the URL to the folder that contains the images ---&gt;
	&lt;cfset url_image_path = &quot;http://www.homeshq.com/gfx/promotion/&quot; /&gt;
	&lt;!--- do not edit below this point ---&gt;
	&lt;!--- lets get the contents of the folder ---&gt;
	&lt;cfdirectory directory=&quot;#folder#&quot; action=&quot;list&quot; name=&quot;filelisting&quot; /&gt;
	&lt;!--- pull just file names out of the list ---&gt;
	&lt;cfset fileList = &quot;&quot; /&gt;
	&lt;cfoutput query=&quot;filelisting&quot;&gt;
		&lt;cfif filelisting.type is &quot;file&quot;&gt;
			&lt;cfset fileList = listappend(fileList,filelisting.name) /&gt;
		&lt;/cfif&gt;
	&lt;/cfoutput&gt;
	&lt;!--- now we can create a new list of files ---&gt;
	&lt;cfset new_fileList = &quot;&quot;&gt;
	&lt;cfloop list=&quot;#fileList#&quot; index=&quot;i&quot; delimiters=&quot;,&quot;&gt;
	&lt;!--- lets use our list of extensions to weed out the files types we don't want ---&gt;
	&lt;!--- now we grab just the extension ---&gt;
		&lt;cfset file_ext = listlast(i,&quot;.&quot;) /&gt;
		&lt;!--- if it finds file_ext is acceptable as per ext then it adds it to the array ---&gt;
		&lt;cfif listfindnocase(ext,file_ext,&quot; &quot;)&gt;
			&lt;cfset new_fileList = listappend(new_fileList,i) /&gt;
		&lt;/cfif&gt;
	&lt;/cfloop&gt;
	&lt;!--- now to choose random number from the list ---&gt;
	&lt;cfset image_file = listgetat(new_fileList,randrange(1,listlen(new_fileList),&quot;SHA1PRNG&quot;),&quot;,&quot;) /&gt;
	&lt;cflocation url=&quot;#url_image_path##image_file#?rand=#randrange(1,999999999,&quot;SHA1PRNG&quot;)#&quot; addtoken=&quot;no&quot;&gt;
	&lt;cfcatch type=&quot;any&quot;&gt;&lt;/cfcatch&gt;
&lt;/cftry&gt;
</pre>
]]></content:encoded>
			<wfw:commentRss>http://www.dingobytes.com/coldfusion/coldfusion-image-rotator/feed</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
	</channel>
</rss>

<!-- Performance optimized by W3 Total Cache. Learn more: http://www.w3-edge.com/wordpress-plugins/

Served from: www.dingobytes.com @ 2012-02-05 21:15:26 -->
