<?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>Cyberward.net &#187; gallery</title>
	<atom:link href="http://www.cyberward.net/blog/tag/gallery/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.cyberward.net/blog</link>
	<description>The Drive Failures and Shutter Clicks of Christopher Ward</description>
	<lastBuildDate>Mon, 03 Oct 2011 13:00:27 +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>Full Screen Slideshow in Javascript</title>
		<link>http://www.cyberward.net/blog/2010/02/full-screen-slideshow-in-javascript/</link>
		<comments>http://www.cyberward.net/blog/2010/02/full-screen-slideshow-in-javascript/#comments</comments>
		<pubDate>Mon, 01 Feb 2010 11:30:54 +0000</pubDate>
		<dc:creator>Chris Ward</dc:creator>
				<category><![CDATA[Photography]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[gallery]]></category>
		<category><![CDATA[javascript]]></category>
		<category><![CDATA[photo gallery]]></category>

		<guid isPermaLink="false">http://www.cyberward.net/blog/?p=1760</guid>
		<description><![CDATA[So I now have a full screen slideshow in Javascript, without using flash, and I wanted to tell you how I did it, and how you can do it too. I will talk a bit about Javascript here, but you will be able to download the jQuery plugin I have without needing to know much, [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.cyberward.net/photography/"><img class="alignnone size-full wp-image-1777" title="Gallery Slideshow Screen Shot" src="http://www.cyberward.net/blog/wp-content/uploads/screen.jpg" alt="" width="500" height="396" /></a></p>
<p>So I now have a full screen <a href="http://cyberward.net/photography/">slideshow</a> in Javascript, without using flash, and I wanted to tell you how I did it, and how you can do it too. I will talk a bit about Javascript here, but you will be able to download the jQuery plugin I have without needing to know much, if all you want is to implement the gallery.</p>
<p>I got the idea for this plugin after looking at a flash version of Scott Kelby&#8217;s <a href="http://www.scottkelby.com/portfolio/">portfolio</a>. I just wanted to give it a try in Javascript.</p>
<p>I have created a <a href="http://www.cyberward.net/blog/code/bgstretcher2/">permanent page</a> for bgStretcher2, so it is easier to find from the side bar, so look <a href="http://www.cyberward.net/blog/code/bgstretcher2/">here</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.cyberward.net/blog/2010/02/full-screen-slideshow-in-javascript/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>How to use Thickbox</title>
		<link>http://www.cyberward.net/blog/2009/04/how-to-use-thickbox/</link>
		<comments>http://www.cyberward.net/blog/2009/04/how-to-use-thickbox/#comments</comments>
		<pubDate>Mon, 13 Apr 2009 17:49:49 +0000</pubDate>
		<dc:creator>Chris Ward</dc:creator>
				<category><![CDATA[Programming]]></category>
		<category><![CDATA[Tutorial]]></category>
		<category><![CDATA[gallery]]></category>
		<category><![CDATA[javascript]]></category>
		<category><![CDATA[jQuery]]></category>
		<category><![CDATA[photo]]></category>
		<category><![CDATA[photo gallery]]></category>
		<category><![CDATA[thickbox]]></category>

		<guid isPermaLink="false">http://www.cyberward.net/blog/?p=980</guid>
		<description><![CDATA[I have had a lot of hits on my How to use Lytebox post, and I thought I might continue it as a series and do something on another of the light box clones. It also looks like lytebox¬†has been discontinued by the author. I have started to use Thickbox.¬†Why you ask? It uses jQuery, [...]]]></description>
			<content:encoded><![CDATA[<p>I have had a lot of hits on my <a href="http://www.cyberward.net/blog/2009/02/how-to-use-lytebox/">How to use Lytebox</a> post, and I thought I might continue it as a series and do something on another of the light box clones. It also looks like lytebox¬†has been discontinued by the author. I have started to use <a href="http://jquery.com/demo/thickbox/">Thickbox</a>.¬†Why you ask? It uses <a href="http://jquery.com/">jQuery</a>, and I am starting to really like that library. One of the things that drew me to lytebox was that it had no dependencies. But now, more sites require javascript anyway, and my library of choice is jQuery. So, if I am using jQuery, why not the Thickbox plugin?</p>
<p>If you are not sure about this library, check out <a href="http://planetozh.com/projects/lightbox-clones/">this matrix</a> that lists just about every light box type javascript library around.</p>
<p><span id="more-980"></span></p>
<h3>Setting up¬†Thickbox</h3>
<p>The <a href="http://jquery.com/demo/thickbox/">thickbox site</a> has great examples too. It is not hard to set up. Head over to the Thickbox site and grab the files. What you need to get are the thickbox.js file, the thickbox.css file, the loadingAnimation.gif, and the macFFBgHack.png. More on the images in a minute.</p>
<p>Don&#8217;t forget, this is a plugin, or aditional library that builds on jQuery, so you will need to <a href="http://docs.jquery.com/Downloading_jQuery">download¬†jQuery</a> too. You will only need one file: jQuery.js. For these¬†examples I am not using the compressed versions, but you could. Both jQuery and Thickbox offer compressed versions of their javascript libraries. They might be worth using in a production environment, but I will use the fully spaced files here.</p>
<p>Ok, first up, I like to have a bit of structure to my web sites. I like to have js, css,¬†images, and pictures folders. You don&#8217;t have to, but this is what I do. I put my javascript into the js folder. I put style sheets into css, icons and graphics for the site into images, and photographs into the pictures folder. So for this example, that is where¬†I put the files.¬†</p>
<pre>/examples/thickbox/js/jquery.js
                 /js/thickbox.js
                 /css/thickbox.js
                 /images/loadingAnimation.gif
                 /images/macFFBgHack.png</pre>
<h3>A few little tweaks</h3>
<p>If you put all of the files into /examples/thickbox/, and not into the structure like we have, you wouldn&#8217;t need to do this step, but if you did, we need to edit a couple of thickbox files to let them know what we did.</p>
<p>You can edit files in any number of ways. If you are on a web server running linux, you might want to try nano. It is pretty easy to use, and gives you some ctrl key combinations at the bottom for thigs like saving and searching.</p>
<p>To edit the index html file in nano type:</p>
<pre>nano -w index.html</pre>
<p>You can move around using the cursor keys, and the terminal will scroll for you. When you want to exit and save, press ctrl-x.</p>
<p>First is the /js/thickbox.js file. We need to modify were the loading animation is located. Change that line to:</p>
<pre>var tb_pathToImage = "images/loadingAnimation.gif";</pre>
<p>This line is inserted into generated html, so the path is relative to the html page created.</p>
<p>Then we need to look at the /css/thickbox.cc file. We need to navigate down through that file and find the .TB_overlayMacFFBGHack class. Change that to:</p>
<pre>.TB_overlayMacFFBGHack {background: url(../images/macFFBgHack.png) repeat;}</pre>
<p>What are these files for? The loading animation is a little bar that shows up inbetween when you click on the image, and the larger one is ready. The overlay image is to help firefox on Mac&#8217;s provide the screen dimming over flash.</p>
<h3>Including our files.</h3>
<p>To get our files &#8216;included&#8217; into a html document, we need to put some lines into the head of the document, like this:</p>

<div class="wp_codebox_msgheader wp_codebox_hide"><span class="right"><sup><a href="http://www.ericbess.com/ericblog/2008/03/03/wp-codebox/#examples" target="_blank" title="WP-CodeBox HowTo?"><span style="color: #99cc00">?</span></a></sup></span><span class="left"><a href="javascript:;" onclick="javascript:showCodeTxt('p980code7'); return false;">View Code</a> HTML</span><div class="codebox_clear"></div></div><div class="wp_codebox"><table><tr id="p9807"><td class="line_numbers"><pre>1
2
</pre></td><td class="code" id="p980code7"><pre class="html" style="font-family:monospace;">&lt;script src=&quot;js/jquery.js&quot; type=&quot;text/javascript&quot;&gt;&lt;!--mce:0--&gt;&lt;/script&gt;
&lt;script src=&quot;js/thickbox.js&quot; type=&quot;text/javascript&quot;&gt;&lt;!--mce:1--&gt;&lt;/script&gt;</pre></td></tr></table></div>

<p>That&#8217;s all there is to it. The two script tags insert the javascript, and the link tag inserts the stylesheet.</p>
<h3>Apply the effect</h3>
<p>Thickbox uses the jQuery library. This means that it is all about selectors. That usually means that we use css class names in our javascript to identify elements on a page. Thickbox uses the &#8220;thickbox&#8221; class to identify what images to apply this effect to.</p>
<p>Here is a line of html that displays a thumbnail, and when you click on it, it takes you to a different page and displays it full screen.</p>

<div class="wp_codebox_msgheader wp_codebox_hide"><span class="right"><sup><a href="http://www.ericbess.com/ericblog/2008/03/03/wp-codebox/#examples" target="_blank" title="WP-CodeBox HowTo?"><span style="color: #99cc00">?</span></a></sup></span><span class="left"><a href="javascript:;" onclick="javascript:showCodeTxt('p980code8'); return false;">View Code</a> HTML</span><div class="codebox_clear"></div></div><div class="wp_codebox"><table><tr id="p9808"><td class="line_numbers"><pre>1
2
</pre></td><td class="code" id="p980code8"><pre class="html" style="font-family:monospace;">&lt;a title=&quot;Montana Cabin&quot; href=&quot;pictures/Montana Cabin.jpg&quot;&gt;
&lt;img src=&quot;pictures/Montana Cabin thumb.jpg&quot; alt=&quot;&quot; /&gt;&lt;/a&gt;</pre></td></tr></table></div>

<p>Here is a line of html that displays a thumbnail, and when you click on it, it uses the thickbox javascript to display the light box type effect.</p>

<div class="wp_codebox_msgheader wp_codebox_hide"><span class="right"><sup><a href="http://www.ericbess.com/ericblog/2008/03/03/wp-codebox/#examples" target="_blank" title="WP-CodeBox HowTo?"><span style="color: #99cc00">?</span></a></sup></span><span class="left"><a href="javascript:;" onclick="javascript:showCodeTxt('p980code9'); return false;">View Code</a> HTML</span><div class="codebox_clear"></div></div><div class="wp_codebox"><table><tr id="p9809"><td class="line_numbers"><pre>1
</pre></td><td class="code" id="p980code9"><pre class="html" style="font-family:monospace;">&lt;a class=&quot;thickbox&quot; title=&quot;Montana Cabin&quot; href=&quot;pictures/Montana Cabin.jpg&quot;&gt;&lt;img src=&quot;pictures/Montana Cabin thumb.jpg&quot; alt=&quot;&quot; /&gt;&lt;/a&gt;</pre></td></tr></table></div>

<p>Not much different is there? The only difference is the class=&#8221;thickbox&#8221;. I think that is pretty cool. How about linking several images together so that you can use next and previous buttons to link them? You just need to add a rel=&#8221;xxx&#8221; where xxx is the name of the gallery. As long as this text is the same for each image you want linked together, it can be anything.</p>

<div class="wp_codebox_msgheader wp_codebox_hide"><span class="right"><sup><a href="http://www.ericbess.com/ericblog/2008/03/03/wp-codebox/#examples" target="_blank" title="WP-CodeBox HowTo?"><span style="color: #99cc00">?</span></a></sup></span><span class="left"><a href="javascript:;" onclick="javascript:showCodeTxt('p980code10'); return false;">View Code</a> HTML</span><div class="codebox_clear"></div></div><div class="wp_codebox"><table><tr id="p98010"><td class="line_numbers"><pre>1
2
</pre></td><td class="code" id="p980code10"><pre class="html" style="font-family:monospace;">&lt;a class=&quot;thickbox&quot; title=&quot;Montana Cabin&quot; rel=&quot;gallery2&quot; href=&quot;pictures/Montana Cabin.jpg&quot;&gt;&lt;img src=&quot;pictures/Montana Cabin thumb.jpg&quot; alt=&quot;&quot; /&gt;&lt;/a&gt;
&lt;a class=&quot;thickbox&quot; title=&quot;Montana Road&quot; rel=&quot;gallery2&quot; href=&quot;pictures/Montana Road.jpg&quot;&gt;&lt;img src=&quot;pictures/Montana Road thumb.jpg&quot; alt=&quot;&quot; /&gt;&lt;/a&gt;</pre></td></tr></table></div>

<h3>The full example</h3>
<p>What I show now is a full example of using this to create a gallery. A very simple one. Not going to win any style awards, but it will do. There are 3 versions of the index.html file here. One <a href="http://www.cyberward.net/examples/thickbox/index.html">without the thickbox</a> effect at all (index.html), one <a href="http://www.cyberward.net/examples/thickbox/index2.html">with the thickbox</a> effect (index2.html), and one with <a href="http://www.cyberward.net/examples/thickbox/index3.html">thickbox using gallerys</a>¬†(index3.html). To make this work I have also added another css file: /css/gallery.css.</p>

<div class="wp_codebox_msgheader wp_codebox_hide"><span class="right"><sup><a href="http://www.ericbess.com/ericblog/2008/03/03/wp-codebox/#examples" target="_blank" title="WP-CodeBox HowTo?"><span style="color: #99cc00">?</span></a></sup></span><span class="left"><a href="javascript:;" onclick="javascript:showCodeTxt('p980code11'); return false;">View Code</a> HTML</span><div class="codebox_clear"></div></div><div class="wp_codebox"><table><tr id="p98011"><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
</pre></td><td class="code" id="p980code11"><pre class="html" style="font-family:monospace;">&nbsp;
  &lt;script src=&quot;js/jquery.js&quot; type=&quot;text/javascript&quot;&gt;&lt;!--mce:2--&gt;&lt;/script&gt;
  &lt;script src=&quot;js/thickbox.js&quot; type=&quot;text/javascript&quot;&gt;&lt;!--mce:3--&gt;&lt;/script&gt;
&lt;h1&gt;Thickbox Example Gallery&lt;/h1&gt;
&lt;h3&gt;
    &lt;a href=&quot;index.html&quot;&gt;No Thickbox&lt;/a&gt;
    &lt;a href=&quot;index2.html&quot;&gt;Using Thickbox&lt;/a&gt;
    &lt;span&gt;Thickbox with Galleries&lt;/span&gt;&lt;/h3&gt;
&lt;a class=&quot;thickbox&quot; title=&quot;Erie Night&quot; rel=&quot;gallery1&quot; href=&quot;pictures/Erie Night.jpg&quot;&gt;&lt;img src=&quot;pictures/Erie Night thumb.jpg&quot; alt=&quot;&quot; /&gt;&lt;/a&gt;
  &lt;a class=&quot;thickbox&quot; title=&quot;Field of Grass&quot; rel=&quot;gallery1&quot; href=&quot;pictures/Field of Grass.jpg&quot;&gt;&lt;img src=&quot;pictures/Field of Grass thumb.jpg&quot; alt=&quot;&quot; /&gt;&lt;/a&gt;
  &lt;a class=&quot;thickbox&quot; title=&quot;Gentle Evening&quot; rel=&quot;gallery1&quot; href=&quot;pictures/Gentle Evening.jpg&quot;&gt;&lt;img src=&quot;pictures/Gentle Evening thumb.jpg&quot; alt=&quot;&quot; /&gt;&lt;/a&gt;
  &lt;a class=&quot;thickbox&quot; title=&quot;Reflected Cloud&quot; rel=&quot;gallery1&quot; href=&quot;pictures/Reflected Cloud.jpg&quot;&gt;&lt;img src=&quot;pictures/Reflected Cloud thumb.jpg&quot; alt=&quot;&quot; /&gt;&lt;/a&gt;
&nbsp;
  &lt;a class=&quot;thickbox&quot; title=&quot;Montana Cabin&quot; rel=&quot;gallery2&quot; href=&quot;pictures/Montana Cabin.jpg&quot;&gt;&lt;img src=&quot;pictures/Montana Cabin thumb.jpg&quot; alt=&quot;&quot; /&gt;&lt;/a&gt;
  &lt;a class=&quot;thickbox&quot; title=&quot;Montana Road&quot; rel=&quot;gallery2&quot; href=&quot;pictures/Montana Road.jpg&quot;&gt;&lt;img src=&quot;pictures/Montana Road thumb.jpg&quot; alt=&quot;&quot; /&gt;&lt;/a&gt;
  &lt;a class=&quot;thickbox&quot; title=&quot;Montana Sunset&quot; rel=&quot;gallery2&quot; href=&quot;pictures/Montana Sunset.jpg&quot;&gt;&lt;img src=&quot;pictures/Montana Sunset thumb.jpg&quot; alt=&quot;&quot; /&gt;&lt;/a&gt;
  &lt;a class=&quot;thickbox&quot; title=&quot;Spoon and Cherry&quot; rel=&quot;gallery2&quot; href=&quot;pictures/Spoon and Cherry.jpg&quot;&gt;&lt;img src=&quot;pictures/Spoon and Cherry thumb.jpg&quot; alt=&quot;&quot; /&gt;&lt;/a&gt;
&lt;h3&gt;&lt;a href=&quot;http://www.cyberward.net/blog/2009/04/how-to-use-thickbox/&quot;&gt;Cyberward blog post on Thickbox&lt;/a&gt;&lt;/h3&gt;</pre></td></tr></table></div>


<div class="wp_codebox_msgheader wp_codebox_hide"><span class="right"><sup><a href="http://www.ericbess.com/ericblog/2008/03/03/wp-codebox/#examples" target="_blank" title="WP-CodeBox HowTo?"><span style="color: #99cc00">?</span></a></sup></span><span class="left"><a href="javascript:;" onclick="javascript:showCodeTxt('p980code12'); return false;">View Code</a> CSS</span><div class="codebox_clear"></div></div><div class="wp_codebox"><table><tr id="p98012"><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
</pre></td><td class="code" id="p980code12"><pre class="css" style="font-family:monospace;">body <span style="color: #00AA00;">&#123;</span>
        <span style="color: #000000; font-weight: bold;">background-color</span><span style="color: #00AA00;">:</span> <span style="color: #000000; font-weight: bold;">black</span><span style="color: #00AA00;">;</span>
        <span style="color: #000000; font-weight: bold;">text-align</span><span style="color: #00AA00;">:</span> <span style="color: #993333;">center</span><span style="color: #00AA00;">;</span>
        <span style="color: #000000; font-weight: bold;">margin</span><span style="color: #00AA00;">:</span><span style="color: #933;">10px</span><span style="color: #00AA00;">;</span>
<span style="color: #00AA00;">&#125;</span>
h1<span style="color: #00AA00;">,</span> h3<span style="color: #00AA00;">,</span> h3 a<span style="color: #00AA00;">,</span> span <span style="color: #00AA00;">&#123;</span>
        <span style="color: #000000; font-weight: bold;">color</span><span style="color: #00AA00;">:</span> <span style="color: #993333;">white</span><span style="color: #00AA00;">;</span>
        <span style="color: #000000; font-weight: bold;">font-family</span><span style="color: #00AA00;">:</span> <span style="color: #993333;">sans-serif</span><span style="color: #00AA00;">;</span>
        <span style="color: #000000; font-weight: bold;">margin</span><span style="color: #00AA00;">:</span><span style="color: #933;">10px</span><span style="color: #00AA00;">;</span>
<span style="color: #00AA00;">&#125;</span>
img <span style="color: #00AA00;">&#123;</span>
        <span style="color: #000000; font-weight: bold;">border</span><span style="color: #00AA00;">:</span> <span style="color: #993333;">solid</span> <span style="color: #933;">1px</span> <span style="color: #993333;">gray</span><span style="color: #00AA00;">;</span>
<span style="color: #00AA00;">&#125;</span>
img<span style="color: #3333ff;">:hover </span><span style="color: #00AA00;">&#123;</span>
        <span style="color: #000000; font-weight: bold;">border</span><span style="color: #00AA00;">:</span> <span style="color: #993333;">solid</span> <span style="color: #933;">1px</span> <span style="color: #993333;">white</span><span style="color: #00AA00;">;</span>
        <span style="color: #808080; font-style: italic;">/* doesn't work in ie */</span>
<span style="color: #00AA00;">&#125;</span>
a img <span style="color: #00AA00;">&#123;</span>
        <span style="color: #000000; font-weight: bold;">text-decoration</span><span style="color: #00AA00;">:</span> <span style="color: #993333;">none</span><span style="color: #00AA00;">;</span>
<span style="color: #00AA00;">&#125;</span></pre></td></tr></table></div>

<p>There you have it. A pretty simple gallery. Fell free to copy it. You will just need to download the files from jQuery and Thickbox, and get your own images. Have fun.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.cyberward.net/blog/2009/04/how-to-use-thickbox/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
		<item>
		<title>Zen Photo Press</title>
		<link>http://www.cyberward.net/blog/2009/03/zen-photo-press/</link>
		<comments>http://www.cyberward.net/blog/2009/03/zen-photo-press/#comments</comments>
		<pubDate>Fri, 13 Mar 2009 21:26:24 +0000</pubDate>
		<dc:creator>Chris Ward</dc:creator>
				<category><![CDATA[Site News]]></category>
		<category><![CDATA[Software]]></category>
		<category><![CDATA[gallery]]></category>
		<category><![CDATA[plugin]]></category>
		<category><![CDATA[wordpress]]></category>
		<category><![CDATA[zen photo]]></category>

		<guid isPermaLink="false">http://www.cyberward.net/blog/?p=848</guid>
		<description><![CDATA[I am not sure how I missed this. There is a plugin for WordPress called ZenPhotoPress. I even had ideas of trying to do this myself. Anyway, what this does, is allow you to get your photo&#8217;s from Zen Photo into your wordpress blog. It is built into the visual editor (tiny mce). I have [...]]]></description>
			<content:encoded><![CDATA[<p>I am not sure how I missed this. There is a plugin for <a href="http://wordpress.org">WordPress</a> called <a href="http://wordpress.org/extend/plugins/zenphotopress/">ZenPhotoPress</a>. I even had ideas of trying to do this myself. Anyway, what this does, is allow you to get your photo&#8217;s from <a href="http://www.zenphoto.org/">Zen Photo</a> into your wordpress blog. It is built into the visual editor (tiny mce).</p>
<p>I have been working on a gallery with Zen Photo with my Cyberward theme. Still trying to decide what I want to do with it, but I think that I will move to migrate my family photos over to Zen Photo instead of <a href="http://gallery.menalto.com/">Gallery</a>.</p>
<p>Zen Photo just seems better in my opinion. Gallery (actually Gallery2) seems slow and burdened. Too many things activated and going on by default.¬† Zen Photo has fewer plugins, but that&#8217;s ok by me. It seems much easier to hack on too. I guess now I just need to time to do this.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.cyberward.net/blog/2009/03/zen-photo-press/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>How to use Lytebox</title>
		<link>http://www.cyberward.net/blog/2009/02/how-to-use-lytebox/</link>
		<comments>http://www.cyberward.net/blog/2009/02/how-to-use-lytebox/#comments</comments>
		<pubDate>Sun, 01 Mar 2009 05:25:02 +0000</pubDate>
		<dc:creator>Chris Ward</dc:creator>
				<category><![CDATA[Programming]]></category>
		<category><![CDATA[Tutorial]]></category>
		<category><![CDATA[gallery]]></category>
		<category><![CDATA[lytebox]]></category>

		<guid isPermaLink="false">http://www.cyberward.net/blog/?p=778</guid>
		<description><![CDATA[Note: lytebox appears to be discontinued by the author. See also Thickbox. I was recently asked how to use lytebox in a gallery. The instructions at lyteboxes web page has several examples, but I guess they can seem a little overwhelming for some people, so I put together as basic an example as I could [...]]]></description>
			<content:encoded><![CDATA[<p>Note: lytebox appears to be discontinued by the author. See also <a href="http://www.cyberward.net/blog/2009/04/how-to-use-thickbox/">Thickbox</a>.</p>
<p>I was recently asked how to use lytebox in a gallery. The instructions at <a href="http://www.dolem.com/lytebox/">lyteboxes web page</a> has several examples, but I guess they can seem a little overwhelming for some people, so I put together as basic an example as I could think of. It looks like <a href="http://www.cyberward.net/examples/lytebox/index.html">this</a>.</p>
<p>In this example, we are only dealing with useing lytebox with images in gallerys. There are lots of ways to use this library, and you can check his web page for the other options.</p>
<p>First, in order to use this library you need to get some files moved over. There are three things you need:</p>
<ol>
<li>lytebox.js</li>
<li>lytebox.css</li>
<li>images folder</li>
</ol>
<p>These files need to be placed in the folder where your html file is going to be. So, for our example, this is what I have :</p>
<ol>
<li>index.html</li>
<li>lytebox.js</li>
<li>lytebox.css</li>
<li>gallery.css</li>
<li>images (folder)</li>
<li>pictures (folder)</li>
</ol>
<p>index.html is the gallery html file that has the thumbnails and pulls everything together. gallery.css is a css file to style our little gallery just a bit. You don&#8217;t need this file at all. The pictures folder is where I have all my images. You can organize your images how you would like.</p>
<p>Ok, lets look that what index.html looks like. The first thing you need to do is put some code in the &lt;head&gt; tag. This is to tell the browser where the lytebox css and js files are.</p>

<div class="wp_codebox_msgheader"><span class="right"><sup><a href="http://www.ericbess.com/ericblog/2008/03/03/wp-codebox/#examples" target="_blank" title="WP-CodeBox HowTo?"><span style="color: #99cc00">?</span></a></sup></span><span class="left"><a href="javascript:;" onclick="javascript:showCodeTxt('p778code17'); return false;">View Code</a> HTML</span><div class="codebox_clear"></div></div><div class="wp_codebox"><table><tr id="p77817"><td class="line_numbers"><pre>1
2
</pre></td><td class="code" id="p778code17"><pre class="html" style="font-family:monospace;">&lt;script type=&quot;text/javascript&quot; language=&quot;javascript&quot; src=&quot;lytebox.js&quot;&gt;&lt;/script&gt;
&lt;link rel=&quot;stylesheet&quot; href=&quot;lytebox.css&quot; type=&quot;text/css&quot; media=&quot;screen&quot; /&gt;</pre></td></tr></table></div>

<p>Then you need to create the links in the body of your document. I have chosen to link thumbnails to larger size images. Here is the code to one image:</p>

<div class="wp_codebox_msgheader"><span class="right"><sup><a href="http://www.ericbess.com/ericblog/2008/03/03/wp-codebox/#examples" target="_blank" title="WP-CodeBox HowTo?"><span style="color: #99cc00">?</span></a></sup></span><span class="left"><a href="javascript:;" onclick="javascript:showCodeTxt('p778code18'); return false;">View Code</a> HTML</span><div class="codebox_clear"></div></div><div class="wp_codebox"><table><tr id="p77818"><td class="line_numbers"><pre>1
</pre></td><td class="code" id="p778code18"><pre class="html" style="font-family:monospace;">&lt;a href=&quot;pictures/Erie Night.jpg&quot; rel=&quot;lytebox[gallery1]&quot; title=&quot;Erie Night&quot;&gt;&lt;img src=&quot;pictures/Erie Night thumb.jpg&quot;&gt;&lt;/a&gt;</pre></td></tr></table></div>

<p>So, the path to the thumbnail is in the img tag. That is what shows up first. Then, in the a tag, you add the rel attribute. This is not really standard html. Html is not using the rel attribute, so lytebox has decided to use the attribute to signal it that you are linking the image within the href of the a tag through lytebox. This all happens in the background when your document loads, the lytebox.js file scans your document looking for these rel attributes, and adds some code to make it all work.</p>
<p>Also, look at the this: rel=&#8221;lytebox[gallery1]&#8220;. To make this work, you only need to say rel=&#8221;lytebox&#8221;. We put &#8220;gallery1&#8243; inside the [] to link all these images together. This way lytebox knows to link these images together with &#8220;next&#8221; and &#8220;previous&#8221; buttons when the larger image comes up. In the example that I have here, I have two gallery&#8217;s, &#8220;gallery1&#8243; and &#8220;gallery2&#8243; so you can see how they work. One gallery per line.</p>
<p>Simple? Ok, so here is all the code in our example. I have here the code for the index.html and the gallery.css file. I have not listed the lytebox code. You can download that <a href="http://www.dolem.com/lytebox/">here</a>.</p>

<div class="wp_codebox_msgheader wp_codebox_hide"><span class="right"><sup><a href="http://www.ericbess.com/ericblog/2008/03/03/wp-codebox/#examples" target="_blank" title="WP-CodeBox HowTo?"><span style="color: #99cc00">?</span></a></sup></span><span class="left"><a href="javascript:;" onclick="javascript:showCodeTxt('p778code19'); return false;">View Code</a> HTML</span><div class="codebox_clear"></div></div><div class="wp_codebox"><table><tr id="p77819"><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
</pre></td><td class="code" id="p778code19"><pre class="html" style="font-family:monospace;">&lt;html&gt;
&lt;head&gt;
	&lt;title&gt;Lytebox Example&lt;/title&gt;
	&lt;script type=&quot;text/javascript&quot; language=&quot;javascript&quot; src=&quot;lytebox.js&quot;&gt;&lt;/script&gt;
	&lt;link rel=&quot;stylesheet&quot; href=&quot;lytebox.css&quot; type=&quot;text/css&quot; media=&quot;screen&quot; /&gt;
	&lt;link rel=&quot;stylesheet&quot; href=&quot;gallery.css&quot; type=&quot;text/css&quot; media=&quot;screen&quot; /&gt;
&lt;/head&gt;
&lt;body&gt;
	&lt;h1&gt;Lytebox Example Gallery&lt;/h1&gt;
	&lt;a href=&quot;pictures/Erie Night.jpg&quot; rel=&quot;lytebox[gallery1]&quot; title=&quot;Erie Night&quot;&gt;&lt;img src=&quot;pictures/Erie Night thumb.jpg&quot;&gt;&lt;/a&gt;
	&lt;a href=&quot;pictures/Field of Grass.jpg&quot; rel=&quot;lytebox[gallery1]&quot; title=&quot;Field of Grass&quot;&gt;&lt;img src=&quot;pictures/Field of Grass thumb.jpg&quot;&gt;&lt;/a&gt;
	&lt;a href=&quot;pictures/Gentle Evening.jpg&quot; rel=&quot;lytebox[gallery1]&quot; title=&quot;Gentle Evening&quot;&gt;&lt;img src=&quot;pictures/Gentle Evening thumb.jpg&quot;&gt;&lt;/a&gt;
	&lt;a href=&quot;pictures/Reflected Cloud.jpg&quot; rel=&quot;lytebox[gallery1]&quot; title=&quot;Reflected Cloud&quot;&gt;&lt;img src=&quot;pictures/Reflected Cloud thumb.jpg&quot;&gt;&lt;/a&gt;
	&lt;br /&gt;
	&lt;a href=&quot;pictures/Montana Cabin.jpg&quot; rel=&quot;lytebox[gallery2]&quot; title=&quot;Montana Cabin&quot;&gt;&lt;img src=&quot;pictures/Montana Cabin thumb.jpg&quot;&gt;&lt;/a&gt;
	&lt;a href=&quot;pictures/Montana Road.jpg&quot; rel=&quot;lytebox[gallery2]&quot; title=&quot;Montana Road&quot;&gt;&lt;img src=&quot;pictures/Montana Road thumb.jpg&quot;&gt;&lt;/a&gt;
	&lt;a href=&quot;pictures/Montana Sunset.jpg&quot; rel=&quot;lytebox[gallery2]&quot; title=&quot;Montana Sunset&quot;&gt;&lt;img src=&quot;pictures/Montana Sunset thumb.jpg&quot;&gt;&lt;/a&gt;
	&lt;a href=&quot;pictures/Spoon and Cherry.jpg&quot; rel=&quot;lytebox[gallery2]&quot; title=&quot;Spoon and Cherry&quot;&gt;&lt;img src=&quot;pictures/Spoon and Cherry thumb.jpg&quot;&gt;&lt;/a&gt;
&lt;/body&gt;
&lt;/html&gt;</pre></td></tr></table></div>


<div class="wp_codebox_msgheader wp_codebox_hide"><span class="right"><sup><a href="http://www.ericbess.com/ericblog/2008/03/03/wp-codebox/#examples" target="_blank" title="WP-CodeBox HowTo?"><span style="color: #99cc00">?</span></a></sup></span><span class="left"><a href="javascript:;" onclick="javascript:showCodeTxt('p778code20'); return false;">View Code</a> CSS</span><div class="codebox_clear"></div></div><div class="wp_codebox"><table><tr id="p77820"><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
</pre></td><td class="code" id="p778code20"><pre class="css" style="font-family:monospace;">body <span style="color: #00AA00;">&#123;</span>
	<span style="color: #000000; font-weight: bold;">background-color</span><span style="color: #00AA00;">:</span> <span style="color: #000000; font-weight: bold;">black</span><span style="color: #00AA00;">;</span>
	<span style="color: #000000; font-weight: bold;">text-align</span><span style="color: #00AA00;">:</span> <span style="color: #993333;">center</span><span style="color: #00AA00;">;</span>
<span style="color: #00AA00;">&#125;</span>
h1 <span style="color: #00AA00;">&#123;</span>
	<span style="color: #000000; font-weight: bold;">color</span><span style="color: #00AA00;">:</span> <span style="color: #993333;">white</span><span style="color: #00AA00;">;</span>
	<span style="color: #000000; font-weight: bold;">font-family</span><span style="color: #00AA00;">:</span> <span style="color: #993333;">sans-serif</span><span style="color: #00AA00;">;</span>
<span style="color: #00AA00;">&#125;</span>
img <span style="color: #00AA00;">&#123;</span>
	<span style="color: #000000; font-weight: bold;">border</span><span style="color: #00AA00;">:</span> <span style="color: #993333;">solid</span> <span style="color: #933;">1px</span> <span style="color: #993333;">gray</span><span style="color: #00AA00;">;</span>
<span style="color: #00AA00;">&#125;</span>
img<span style="color: #3333ff;">:hover </span><span style="color: #00AA00;">&#123;</span>
	<span style="color: #000000; font-weight: bold;">border</span><span style="color: #00AA00;">:</span> <span style="color: #993333;">solid</span> <span style="color: #933;">1px</span> <span style="color: #993333;">white</span><span style="color: #00AA00;">;</span>
	<span style="color: #808080; font-style: italic;">/* doesn't work in ie */</span>
<span style="color: #00AA00;">&#125;</span></pre></td></tr></table></div>

<p>Check out the finished gallery <a href="http://www.cyberward.net/examples/lytebox/index.html">here</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.cyberward.net/blog/2009/02/how-to-use-lytebox/feed/</wfw:commentRss>
		<slash:comments>35</slash:comments>
		</item>
		<item>
		<title>Moving Pictures via Javascript</title>
		<link>http://www.cyberward.net/blog/2009/01/moving-pictures-via-javascript/</link>
		<comments>http://www.cyberward.net/blog/2009/01/moving-pictures-via-javascript/#comments</comments>
		<pubDate>Tue, 13 Jan 2009 13:00:47 +0000</pubDate>
		<dc:creator>Chris Ward</dc:creator>
				<category><![CDATA[Programming]]></category>
		<category><![CDATA[collage]]></category>
		<category><![CDATA[gallery]]></category>
		<category><![CDATA[javascript]]></category>
		<category><![CDATA[lytebox]]></category>

		<guid isPermaLink="false">http://www.cyberward.net/blog/?p=394</guid>
		<description><![CDATA[Ok, I had promised to let anyone know that happened to be reading before Christmas, that I would talk about the collage script that I am using on the Christoper Ward Photography site. I am using the lytebox script when you click on an image, but the collage image that moves the pictures around the [...]]]></description>
			<content:encoded><![CDATA[<p>Ok, I had promised to let anyone know that happened to be reading before Christmas, that I would talk about the collage script that I am using on the <a href="http://christopherwardphotography.com">Christoper Ward Photography</a> site. I am using the <a href="http://www.dolem.com/lytebox/">lytebox</a> script when you click on an image, but the collage image that moves the pictures around the screen is all mine.</p>
<p>You can get the html source from that page. Here is the Javascript and the CSS files that are used. You can use this code, but please leave the Javascript comment header with my name on it.</p>
<pre lang="Javascript" name="collage.js">
/*
	collage javascript

	You are free to use this script provided you include this header

	Created by Chris Ward
	veggie2u@cyberward.net

http://www.cyberward.net/blog/

*/

function Collage(pName) {
	this.name = pName;
	this.state = "closed";
	Collage.list[Collage.quantity] = this;
	Collage.quantity += 1;
}

Collage.prototype.open = function() {
	Collage.closeAll();
	for( i=0; i < this.endPoints.length; i++ ) {
		$image = this.name+'img'+(i+1);
		new Effect.Move($($image), { x:this.endPoints[i][0], y:this.endPoints[i][1], mode: 'absolute' });
	}
	this.state = "open";
}

Collage.prototype.close = function() {
	for( i=0; i < this.endPoints.length; i++ ) {
		$image = this.name+'img'+(i+1);
		new Effect.Move($($image), { x:this.startPoint[0], y:this.startPoint[1], mode: 'absolute' });
	}
	this.state = "closed";
}

Collage.prototype.swap = function() {
	if( this.state == "closed" ) {
		this.open();
	} else {
		this.close();
	}
}

Collage.closeAll = function() {
	for( i=0; i < Collage.quantity; i++ ) {
		var $aCollage = Collage.list[i];
		if( $aCollage.state == "open" ) {
			$aCollage.close();
		}
	}
}

function doOnLoad() {
	$$('img.collageImg').each(function(s) {
		s.show();
	});
	collage1.swap();
}

Collage.quantity = 0;
Collage.list = new Array();

var collage1 = new Collage("g1");
collage1.endPoints = [ [280, 80], [300, 180], [400,100], [580,120], [500,200], [280,400], [340,320], [540,290], [480,380], [620, 440] ];
collage1.startPoint = [4, 60];

var collage2 = new Collage("g2");
collage2.endPoints = [ [220, 100], [360, 120], [280,220], [300,390], [380,300], [580,100], [500,180], [470,420], [560,330], [660, 420] ];
collage2.startPoint = [4, 180];

var collage3 = new Collage("g3");
collage3.endPoints = [ [280, 80], [240, 230], [400,100], [460,180], [280,400], [340,320], [540,290], [600, 400], [580, 130], [480,380] ];
collage3.startPoint = [4, 300];

var collage4 = new Collage("g4");
collage4.endPoints = [ [280, 80], [300, 230], [400,100], [540,120], [580,200], [340,400], [280,320], [480,290], [540,380], [700, 110], [650, 350] ];
collage4.startPoint = [4, 420];
</pre>
<pre lang="css" name="collage.css">
body {
	background: black;
	margin:0;
	padding:0;
	height:100%;
}

#albums {
	position:absolute;
	top:10px;
	left:20px;
}

#about {
	position:absolute;
	top:530px;
	left:10px;
}

#about img {
	border:0;
}
#about a {
	text-decoration:none;
}

#title {
	position:absolute;
	top:10px;
	left:220px;
}

#collages {
	background-image:url("./images/albums_background.png");
	position:absolute;
	left:0;
	top:0;
	width: 180px;
	height: 100%;
	margin-top:0px;
	margin-bottom:0px;
}
#collages img {
	margin: 10px;
}

#content {
	margin-left:180px;
	color:white;
}
#content img {
	border:0;
	display:block;
	margin-left:auto;
	margin-right:auto;
}

.collageImg {
	border: 1px solid white;
}

.collageThumb {
	opacity:0.4;filter:alpha(opacity=40);
	border: 1px solid white;
}

#g1img1, #g1img2, #g1img3, #g1img4, #g1img5, #g1img6, #g1img7, #g1img8, #g1img9, #g1img10, #g1img11 {
	position: absolute; top: 60px; left: 4px;
}
#g1img11 {
	opacity:0.4;filter:alpha(opacity=40);
}

#g2img1, #g2img2, #g2img3, #g2img4, #g2img5, #g2img6, #g2img7, #g2img8, #g2img9, #g2img10, #g2img11 {
		position: absolute; top: 180px; left: 4px;
}
#g2img11 {
		opacity:0.4;filter:alpha(opacity=40);
}

#g3img1, #g3img2, #g3img3, #g3img4, #g3img5, #g3img6, #g3img7, #g3img8, #g3img9, #g3img10, #g3img11 {
		position: absolute; top: 300px; left: 4px;
}
#g3img11 {
		opacity:0.4;filter:alpha(opacity=40);
}

#g4img1, #g4img2, #g4img3, #g4img4, #g4img5, #g4img6, #g4img7, #g4img8, #g4img9, #g4img10, #g4img11, #g4img12 {
		position: absolute; top: 420px; left: 4px;
}
#g4img12 {
		opacity:0.4;filter:alpha(opacity=40);
}
</pre>
<p>The way that it is implemented is pretty simple. In order to make this work, I relied on a naming convention. Lets look at one image:</p>

<div class="wp_codebox_msgheader"><span class="right"><sup><a href="http://www.ericbess.com/ericblog/2008/03/03/wp-codebox/#examples" target="_blank" title="WP-CodeBox HowTo?"><span style="color: #99cc00">?</span></a></sup></span><span class="left"><a href="javascript:;" onclick="javascript:showCodeTxt('p394code25'); return false;">View Code</a> JAVASCRIPT</span><div class="codebox_clear"></div></div><div class="wp_codebox"><table><tr id="p39425"><td class="line_numbers"><pre>1
</pre></td><td class="code" id="p394code25"><pre class="javascript" style="font-family:monospace;"><span style="color: #339933;">&lt;</span>a href<span style="color: #339933;">=</span><span style="color: #3366CC;">&quot;./pictures/Blue/Erie Night.jpg&quot;</span> rel<span style="color: #339933;">=</span><span style="color: #3366CC;">&quot;lytebox[one]&quot;</span> title<span style="color: #339933;">=</span><span style="color: #3366CC;">&quot;Erie Night&quot;</span><span style="color: #339933;">&gt;&lt;</span>img id<span style="color: #339933;">=</span><span style="color: #3366CC;">&quot;g1img1&quot;</span> <span style="color: #003366; font-weight: bold;">class</span><span style="color: #339933;">=</span><span style="color: #3366CC;">&quot;collageImg&quot;</span> style<span style="color: #339933;">=</span><span style="color: #3366CC;">&quot;display:none;&quot;</span> src<span style="color: #339933;">=</span><span style="color: #3366CC;">&quot;./pictures/Blue/Erie Night (1).jpg&quot;</span><span style="color: #339933;">/&gt;&lt;/</span>a<span style="color: #339933;">&gt;</span></pre></td></tr></table></div>

<p>The id of the image is set to g1 for 'gallery 1', img1 for 'image 1'. If you look at the html, I had to add this logical id to every image. This is a very tedious process. There is also the code for lytebox, namely the rel="lytebox[one]" to launch the lytebox script when the image is clicked, and link all the 'one' galleries together. The other thing on this line is the style="display:none;" part. This bugs me, but it appears to be a css limitation I can't get around. Because all the images are stacked, they all appear in turn as they are downloaded without this. If I put this style in the css, then javascript can't turn it back on! It has to be an inline style. I would love to hear a solution for this.</p>
<p>Then we have one more line from the html file to look at.</p>

<div class="wp_codebox_msgheader"><span class="right"><sup><a href="http://www.ericbess.com/ericblog/2008/03/03/wp-codebox/#examples" target="_blank" title="WP-CodeBox HowTo?"><span style="color: #99cc00">?</span></a></sup></span><span class="left"><a href="javascript:;" onclick="javascript:showCodeTxt('p394code26'); return false;">View Code</a> JAVASCRIPT</span><div class="codebox_clear"></div></div><div class="wp_codebox"><table><tr id="p39426"><td class="line_numbers"><pre>1
</pre></td><td class="code" id="p394code26"><pre class="javascript" style="font-family:monospace;"><span style="color: #339933;">&lt;</span>a href<span style="color: #339933;">=</span><span style="color: #3366CC;">&quot;#&quot;</span> onClick<span style="color: #339933;">=</span><span style="color: #3366CC;">&quot;collage1.swap();&quot;</span><span style="color: #339933;">&gt;&lt;</span>img id<span style="color: #339933;">=</span><span style="color: #3366CC;">&quot;g1img11&quot;</span> <span style="color: #003366; font-weight: bold;">class</span><span style="color: #339933;">=</span><span style="color: #3366CC;">&quot;collageThumb&quot;</span> src<span style="color: #339933;">=</span><span style="color: #3366CC;">&quot;./pictures/Blue/Montana Road (1).jpg&quot;</span><span style="color: #339933;">/&gt;&lt;/</span>a<span style="color: #339933;">&gt;</span></pre></td></tr></table></div>

<p>This line is the last line in each gallery, and is the last image repeated. This is the one that will not move, and forms the thumbnail for the gallery. Via css, the transparency is lowered when the collage is out. This image contains the onClick call to move the images.</p>
<p>Now onto the javascript. Look at this bit of code that defines a collage:</p>

<div class="wp_codebox_msgheader"><span class="right"><sup><a href="http://www.ericbess.com/ericblog/2008/03/03/wp-codebox/#examples" target="_blank" title="WP-CodeBox HowTo?"><span style="color: #99cc00">?</span></a></sup></span><span class="left"><a href="javascript:;" onclick="javascript:showCodeTxt('p394code27'); return false;">View Code</a> JAVASCRIPT</span><div class="codebox_clear"></div></div><div class="wp_codebox"><table><tr id="p39427"><td class="line_numbers"><pre>1
2
3
</pre></td><td class="code" id="p394code27"><pre class="javascript" style="font-family:monospace;"><span style="color: #003366; font-weight: bold;">var</span> collage1 <span style="color: #339933;">=</span> <span style="color: #003366; font-weight: bold;">new</span> Collage<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;g1&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
collage1.<span style="color: #660066;">endPoints</span> <span style="color: #339933;">=</span> <span style="color: #009900;">&#91;</span> <span style="color: #009900;">&#91;</span><span style="color: #CC0000;">280</span><span style="color: #339933;">,</span> <span style="color: #CC0000;">80</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">,</span> <span style="color: #009900;">&#91;</span><span style="color: #CC0000;">300</span><span style="color: #339933;">,</span> <span style="color: #CC0000;">180</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">,</span> <span style="color: #009900;">&#91;</span><span style="color: #CC0000;">400</span><span style="color: #339933;">,</span><span style="color: #CC0000;">100</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">,</span> <span style="color: #009900;">&#91;</span><span style="color: #CC0000;">580</span><span style="color: #339933;">,</span><span style="color: #CC0000;">120</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">,</span> <span style="color: #009900;">&#91;</span><span style="color: #CC0000;">500</span><span style="color: #339933;">,</span><span style="color: #CC0000;">200</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">,</span> <span style="color: #009900;">&#91;</span><span style="color: #CC0000;">280</span><span style="color: #339933;">,</span><span style="color: #CC0000;">400</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">,</span> <span style="color: #009900;">&#91;</span><span style="color: #CC0000;">340</span><span style="color: #339933;">,</span><span style="color: #CC0000;">320</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">,</span> <span style="color: #009900;">&#91;</span><span style="color: #CC0000;">540</span><span style="color: #339933;">,</span><span style="color: #CC0000;">290</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">,</span> <span style="color: #009900;">&#91;</span><span style="color: #CC0000;">480</span><span style="color: #339933;">,</span><span style="color: #CC0000;">380</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">,</span> <span style="color: #009900;">&#91;</span><span style="color: #CC0000;">620</span><span style="color: #339933;">,</span> <span style="color: #CC0000;">440</span><span style="color: #009900;">&#93;</span> <span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span>
collage1.<span style="color: #660066;">startPoint</span> <span style="color: #339933;">=</span> <span style="color: #009900;">&#91;</span><span style="color: #CC0000;">4</span><span style="color: #339933;">,</span> <span style="color: #CC0000;">60</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span></pre></td></tr></table></div>

<p>This defines gallery 1 ("g1"). All those numbers are the end points for where each image will be when the collage is expanded. Again, this is a pain, and it can be confusing which image you are adjusting when changing the numbers.</p>
<p>So lets look at the open function:</p>

<div class="wp_codebox_msgheader"><span class="right"><sup><a href="http://www.ericbess.com/ericblog/2008/03/03/wp-codebox/#examples" target="_blank" title="WP-CodeBox HowTo?"><span style="color: #99cc00">?</span></a></sup></span><span class="left"><a href="javascript:;" onclick="javascript:showCodeTxt('p394code28'); return false;">View Code</a> JAVASCRIPT</span><div class="codebox_clear"></div></div><div class="wp_codebox"><table><tr id="p39428"><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
</pre></td><td class="code" id="p394code28"><pre class="javascript" style="font-family:monospace;">Collage.<span style="color: #660066;">prototype</span>.<span style="color: #000066;">open</span> <span style="color: #339933;">=</span> <span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
	Collage.<span style="color: #660066;">closeAll</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	<span style="color: #000066; font-weight: bold;">for</span><span style="color: #009900;">&#40;</span> i<span style="color: #339933;">=</span><span style="color: #CC0000;">0</span><span style="color: #339933;">;</span> i <span style="color: #339933;">&lt;</span> <span style="color: #000066; font-weight: bold;">this</span>.<span style="color: #660066;">endPoints</span>.<span style="color: #660066;">length</span><span style="color: #339933;">;</span> i<span style="color: #339933;">++</span> <span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
		$image <span style="color: #339933;">=</span> <span style="color: #000066; font-weight: bold;">this</span>.<span style="color: #000066;">name</span><span style="color: #339933;">+</span><span style="color: #3366CC;">'img'</span><span style="color: #339933;">+</span><span style="color: #009900;">&#40;</span>i<span style="color: #339933;">+</span><span style="color: #CC0000;">1</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
		<span style="color: #003366; font-weight: bold;">new</span> Effect.<span style="color: #660066;">Move</span><span style="color: #009900;">&#40;</span>$<span style="color: #009900;">&#40;</span>$image<span style="color: #009900;">&#41;</span><span style="color: #339933;">,</span> <span style="color: #009900;">&#123;</span> x<span style="color: #339933;">:</span><span style="color: #000066; font-weight: bold;">this</span>.<span style="color: #660066;">endPoints</span><span style="color: #009900;">&#91;</span>i<span style="color: #009900;">&#93;</span><span style="color: #009900;">&#91;</span><span style="color: #CC0000;">0</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">,</span> y<span style="color: #339933;">:</span><span style="color: #000066; font-weight: bold;">this</span>.<span style="color: #660066;">endPoints</span><span style="color: #009900;">&#91;</span>i<span style="color: #009900;">&#93;</span><span style="color: #009900;">&#91;</span><span style="color: #CC0000;">1</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">,</span> mode<span style="color: #339933;">:</span> <span style="color: #3366CC;">'absolute'</span> <span style="color: #009900;">&#125;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	<span style="color: #009900;">&#125;</span>
	<span style="color: #000066; font-weight: bold;">this</span>.<span style="color: #660066;">state</span> <span style="color: #339933;">=</span> <span style="color: #3366CC;">&quot;open&quot;</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span></pre></td></tr></table></div>

<p>This is pretty simple. Once I found the Effect.Move() function of scriptaculous, this simply loops over the images in the gallery, and tells the Move function to move the images from where it is (stacked with the others), to the endpoint. The close is similar. It moves the images from where they are (the endpoints) to the start point that was defined in the gallery definition.</p>
<p>The rest of the script is pretty simple. The other methods show all the images (doOnLoad), or set up the swap.</p>
<p>What could be improved? A lot. I don't like defining the galleries and the images through the id field. The user of the collage js has to have intimate knowledge of how the script works in order to set it up. Not only that, but you need matching elements defined in CSS correctly. Having the end point definitions in the js is a pain too. Would would be better, is to come up with a way to have the javascript scan the html and look for images to use, much like how lytebox does it via the rel attribute. Well, guess what? That is exactly what I am working on!</p>
]]></content:encoded>
			<wfw:commentRss>http://www.cyberward.net/blog/2009/01/moving-pictures-via-javascript/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Integrating with WordPress</title>
		<link>http://www.cyberward.net/blog/2008/12/integrating-with-wordpress/</link>
		<comments>http://www.cyberward.net/blog/2008/12/integrating-with-wordpress/#comments</comments>
		<pubDate>Mon, 15 Dec 2008 05:39:36 +0000</pubDate>
		<dc:creator>Chris Ward</dc:creator>
				<category><![CDATA[Programming]]></category>
		<category><![CDATA[gallery]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[plugin]]></category>
		<category><![CDATA[wordpress]]></category>
		<category><![CDATA[zenphoto]]></category>

		<guid isPermaLink="false">http://www.cyberward.net/blog/?p=280</guid>
		<description><![CDATA[I probably should be working on the 2.7 upgrade, but instead I started looking at photo gallery options other than Gallery2. It is just too slow. There is too much of it I don&#8217;t use as well. I think I have settled on zenphoto. It seems to work pretty well, with out the feature creep [...]]]></description>
			<content:encoded><![CDATA[<p>I probably should be working on the 2.7 upgrade, but instead I started looking at photo gallery options other than <a href="http://gallery.menalto.com/">Gallery2</a>. It is just too slow. There is too much of it I don&#8217;t use as well. I think I have settled on <a href="http://www.zenphoto.org/">zenphoto</a>. It seems to work pretty well, with out the feature creep that Gallery2 has. I figured I would convert the <a href="http://annieandchris.net">annieandchris.net</a> site to that.</p>
<p>It got me thinking though about how I might integrate it with WordPress. After seeing the tantan <a href="http://tantannoodles.com/toolkit/photo-album/">Flickr</a> plugin, and how well it works, I figured that there must be a plugin for zenphoto. Well, no. Not really. There are a couple that will let you show pictures in the sidebar. And Trung&#8217;s <a href="http://trunghuynh.com/2008/07/trung_presszen-094/">presszen</a> looked promising, but it didn&#8217;t seem to work. I started taking a look at the code for the tantan Flicker plugin, and saw how he was able to take control of a URI to insert his own code in with the current wordpress theme. I stripped out the relevant stuff, and got it to work. This is the code.</p>

<div class="wp_codebox_msgheader wp_codebox_hide"><span class="right"><sup><a href="http://www.ericbess.com/ericblog/2008/03/03/wp-codebox/#examples" target="_blank" title="WP-CodeBox HowTo?"><span style="color: #99cc00">?</span></a></sup></span><span class="left"><a href="javascript:;" onclick="javascript:showCodeTxt('p280code30'); return false;">View Code</a> PHP</span><div class="codebox_clear"></div></div><div class="wp_codebox"><table><tr id="p28030"><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
</pre></td><td class="code" id="p280code30"><pre class="php" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">function</span> parse_query<span style="color: #009900;">&#40;</span><span style="color: #339933;">&amp;</span>amp<span style="color: #339933;">;</span><span style="color: #000088;">$query</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
	<span style="color: #000088;">$query</span><span style="color: #339933;">-&amp;</span>gt<span style="color: #339933;">;</span>is_404 <span style="color: #339933;">=</span> <span style="color: #009900; font-weight: bold;">false</span><span style="color: #339933;">;</span>
	<span style="color: #000088;">$query</span><span style="color: #339933;">-&amp;</span>gt<span style="color: #339933;">;</span>did_permalink <span style="color: #339933;">=</span> <span style="color: #009900; font-weight: bold;">false</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span>
<span style="color: #000000; font-weight: bold;">function</span> request<span style="color: #009900;">&#40;</span><span style="color: #000088;">$query_vars</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
    <span style="color: #000088;">$query_vars</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'error'</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">=</span> <span style="color: #009900; font-weight: bold;">false</span><span style="color: #339933;">;</span>
    <span style="color: #b1b100;">return</span> <span style="color: #000088;">$query_vars</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span>
&nbsp;
<span style="color: #000000; font-weight: bold;">function</span> cww_template<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
	get_header<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	<span style="color: #b1b100;">echo</span> <span style="color: #0000ff;">'
&lt;div id=&quot;content&quot; class=&quot;narrowcolumn&quot;&gt;
&lt;h2&gt;Zen Integration&lt;/h2&gt;
&lt;/div&gt;
'</span><span style="color: #339933;">;</span>
	get_footer<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	<a href="http://www.php.net/exit"><span style="color: #990000;">exit</span></a><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span>
&nbsp;
<a href="http://www.php.net/define"><span style="color: #990000;">define</span></a><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;CWW_ZEN_BASEURL&quot;</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">&quot;/blog/test&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><a href="http://www.php.net/strpos"><span style="color: #990000;">strpos</span></a><span style="color: #009900;">&#40;</span><span style="color: #000088;">$_SERVER</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'REQUEST_URI'</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">,</span> CWW_ZEN_BASEURL<span style="color: #009900;">&#41;</span> <span style="color: #339933;">===</span> <span style="color: #cc66cc;">0</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
    status_header<span style="color: #009900;">&#40;</span><span style="color: #cc66cc;">200</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    remove_action<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'template_redirect'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'redirect_canonical'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    add_filter<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'request'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'request'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    add_action<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'parse_query'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'parse_query'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    add_action<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'parse_request'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'parse_query'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    add_action<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'template_redirect'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'cww_template'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span> <span style="color: #b1b100;">elseif</span> <span style="color: #009900;">&#40;</span><a href="http://www.php.net/strpos"><span style="color: #990000;">strpos</span></a><span style="color: #009900;">&#40;</span><span style="color: #000088;">$_SERVER</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'REQUEST_URI'</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">.</span><span style="color: #0000ff;">'/'</span><span style="color: #339933;">,</span> CWW_ZEN_BASEURL<span style="color: #009900;">&#41;</span> <span style="color: #339933;">===</span> <span style="color: #cc66cc;">0</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
    <a href="http://www.php.net/header"><span style="color: #990000;">header</span></a><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'location: http://'</span><span style="color: #339933;">.</span><span style="color: #000088;">$_SERVER</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'HTTP_HOST'</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">.</span><span style="color: #000088;">$_SERVER</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'REQUEST_URI'</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">.</span><span style="color: #0000ff;">'/'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    <a href="http://www.php.net/exit"><span style="color: #990000;">exit</span></a><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span>
<span style="color: #000000; font-weight: bold;">?&gt;</span></pre></td></tr></table></div>

<p>I think that I may take a go at pulling in the zenphoto albums in a plugin, and see how it goes. I like how you create plugins in WordPress, and it is kind of fun poking around. It was frustrating for the longest time when I was trying to get it going, and I was getting the body of the blog showing up at the bottom. I finally realized that I needed to &#8216;exit&#8217; the script to prevent the loop from happening. You would think you could override a WordPress function to prevent that instead.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.cyberward.net/blog/2008/12/integrating-with-wordpress/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>My Provider is not #1</title>
		<link>http://www.cyberward.net/blog/2008/06/my-provider-is-not-1/</link>
		<comments>http://www.cyberward.net/blog/2008/06/my-provider-is-not-1/#comments</comments>
		<pubDate>Thu, 19 Jun 2008 23:39:14 +0000</pubDate>
		<dc:creator>Chris Ward</dc:creator>
				<category><![CDATA[Site News]]></category>
		<category><![CDATA[1and1]]></category>
		<category><![CDATA[dreamhost]]></category>
		<category><![CDATA[gallery]]></category>

		<guid isPermaLink="false">http://www.cyberward.net/blog/?p=28</guid>
		<description><![CDATA[I use 1 and 1 as my web provider. Can&#8217;t say that I am completely happy with them. The site can be slow at times, and yesterday and today there have been periods where it was down completely. I do like that I have a full working shell, and can SSH and SCP files to [...]]]></description>
			<content:encoded><![CDATA[<p>I use <a href="http://1and1.com">1 and 1</a> as my web provider. Can&#8217;t say that I am completely happy with them. The site can be slow at times, and yesterday and today there have been periods where it was down completely. I do like that I have a full working shell, and can SSH and SCP files to and from that box easily, but the shell can be ridiculously slow. I tried to look for a replacement. I signed up for <a href="http://www.dreamhost.com/">dreamhost </a>for a bit. When I started with them, it seemed good. The shell seemed much better&#8230; but gallery sucked. <a href="http://gallery.menalto.com/">Gallery</a> is what I use with the family photo site. After looking around the internet, I discovered that many people did not like running gallery on dreamhost for performance reasons. I heard it was the use of remote NFS shares for drive space, but don&#8217;t know for sure if 1 and 1 did anything different. Sigh.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.cyberward.net/blog/2008/06/my-provider-is-not-1/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

