Aleš Gabrovec - tagged with blog http://www.gabrovec.com/feed My lifestream en-us http://blogs.law.harvard.edu/tech/rss Sweetcron ales.gabrovec@gmail.com Get Lightbox to Read Images From a Directory http://www.gabrovec.com/items/view/170/get-lightbox-to-read-images-from-a-directory

I recently came accross a project where I wanted to have the ability to display all the images in a directory dynamically using Lightbox. With a few lines of php, I was able to generate the necessary HTML to get the Lightbox to show the images.

Here's the PHP fucntion:

function returnimages($dirname=".") {
$pattern="(.jpg$)|(.png$)|(.jpeg$)|(.gif$)"; //possible filetypes
$curimage=0;
if($handle = opendir($dirname)) {
while(false !== ($file = readdir($handle))){
if(eregi($pattern, $file)){
echo '<li><a href="'.$file.'"><img src="'.$file.'" alt="" width="120" height="80" /></a></li>';
$curimage++;
}
}
closedir($handle);
}
}
returnimages();

 

The code simply looks in the directory and outputs specific HTML appropriate for lightbox.

View an example of the Lightbox gallery reading images from a directory. Have a look at the source code to see how it all works.

Download a ZIP containing everything you need.

 

]]>
Wed, 04 Feb 2009 02:52:30 -0800 http://www.gabrovec.com/items/view/170/get-lightbox-to-read-images-from-a-directory
A Month Later.. http://www.gabrovec.com/items/view/156/a-month-later

So it's been nearly a month of lifestreaming using Sweetcron and the experience has been wonderful, bug free and rewarding in many ways.

This is actually something I can keep up with so expect to see more information being posted, especially blog posts. Also, expect to see a slight redesign in a few days.

]]>
Tue, 03 Feb 2009 03:15:51 -0800 http://www.gabrovec.com/items/view/156/a-month-later
Finally! http://www.gabrovec.com/items/view/34/finally

Here it is!

For a long time I have been trying to get myself to write a blog, a personal site, portfolio or an online presence that would simply bring together my thoughts, projects and my online engagements in one simple and coherent form. I never fully succeeded. I did attempt a couple of times but never could really keep up due to work load, technical knowledge limitations and pure effort it required.

Well, here it is. Insipired by Jeffrey Zeldmans post "The vanishing personal website" and by the recent popularity of services like Twitter, Facebook, Flickr, FriendFeed and Tumblr, I decided to take another another shot at it. I am thrilled I have found something that seems I can easily maintain and keep all of my activity across various service neatly archived in one place.

I am using Sweetcron to "content outsource" and pull everything together. Set-up was easy and surprisingly there's no bulk added anywhere. Commenting is provided by Disqus that offers amazing functionality and works like a charm. I will write more about my experience with Sweetcron as I use it more.

Enjoy!

]]>
Thu, 08 Jan 2009 06:08:44 -0800 http://www.gabrovec.com/items/view/34/finally