<?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>BigBear Design &#187; PHP</title>
	<atom:link href="http://bigbeardesign.net/blog/category/web-development/php/feed/" rel="self" type="application/rss+xml" />
	<link>http://bigbeardesign.net/blog</link>
	<description>Websites for Small Businesses</description>
	<lastBuildDate>Fri, 26 Sep 2008 13:52:07 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.8.6</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Create A Simple Photo Gallery With 6 Lines of Code</title>
		<link>http://bigbeardesign.net/blog/2006/create-a-simple-photo-gallery-with-6-lines-of-code/</link>
		<comments>http://bigbeardesign.net/blog/2006/create-a-simple-photo-gallery-with-6-lines-of-code/#comments</comments>
		<pubDate>Sat, 15 Jul 2006 08:31:12 +0000</pubDate>
		<dc:creator>emil</dc:creator>
				<category><![CDATA[PHP]]></category>
		<category><![CDATA[web development]]></category>

		<guid isPermaLink="false">http://bigbeardesign.net/blog/2006/07/create-a-simple-photo-gallery-with-6-lines-of-code/</guid>
		<description><![CDATA[A client&#8217;s website needed a simple one-page photo gallery with small thumbnails in a few categories, probably Lightbox opening the photo when clicked. While there are more powerful photo gallery apps or scripts already available, they were too large, or are already taking too long to figure out how to use with the site&#8217;s design. [...]]]></description>
			<content:encoded><![CDATA[<p>A client&#8217;s website needed a simple one-page photo gallery with small thumbnails in a few categories, probably Lightbox opening the photo when clicked. While there are more powerful photo gallery apps or scripts already available, they were too large, or are already taking too long to figure out how to use with the site&#8217;s design. Thankfully, I stumbled upon a link to a PHP article from <a href="http://www.devsource.com/article2/0,1759,1778106,00.asp">DevSource</a> and found out about the <code>glob()</code> function. Here&#8217;s a slightly edited version of the article&#8217;s example:</p>
<p><span id="more-8"></span></p>
<pre><code>
&lt;?php
function getphotos($photogroup) {
  $files = glob ("images/thumbnails/$photogroup-{*.jpg,*.JPG}",  GLOB_BRACE);
  if (is_array($files)) {
    foreach ($files as $image_small) {
      $image_large = str_replace("thumbnails/", "", $image_small);
      echo "&lt;a href=\"$image_large\"&gt;&lt;img src=\"$image_small\" /&gt;&lt;/a&gt; \\n";
  }
}
?&gt;
</code>
</pre>
<p>This loads all jpegs in <em>images/thumbnails/</em> then links to their full-sized counterparts in <em>images/</em>. The files are named with a <em>photogroup-</em> prefix so you can easily load only a particular group of photos. Ex. to load all images <em>beachparty-01.jpg, beachparty-02.jpg, beachparty-03.jpg, etc.</em>, use <code>&lt;?php getphotos("beachparty"); ?&gt;</code>.</p>
<p>P.S. Turn off visual rich editor before trying to post code in Wordpress.</p>
]]></content:encoded>
			<wfw:commentRss>http://bigbeardesign.net/blog/2006/create-a-simple-photo-gallery-with-6-lines-of-code/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

