folderblog
What is folderblog?
Folderblog is a free PHP script that automatically displays the images placed in a given directory, no database needed. It can be used as a blog or gallery — and anything in between.

» demo blog   » learn more   » download now

Discussion
Using FB3 and WordPress(back to index)
Few questions:

1. What do I add to the WordPress sidebar to provide links to my category pages? Can I use tags in WordPress? Is there a tag for number of categories/images?

2. Can I add an image in FB3 to a post in WordPress? If so, how?

3. How do I generate random thumbnails in WordPress sidebar?

Thanks.
posted by agiacosa on 16 Aug 05 at 10:18 PM
1. there is a neat little function for this purpose. It counts all files of a certain type within directories. You could save the code-scrap that is found on the Zend-Code-Gallery in a file. here it is

// function to count images
function CountImages($dir, $type)
{
if(!($dh =@opendir("$dir")))
return false; // directory does not exist or 0 if directory is empty

// read the directory contents searching for "type" files
// and count how many are found:
$files = 0;
while ( ! ( ($fn = readdir($dh)) === false ) )
{
$f = strrev($fn);
$ext = substr($f, 0, strpos($f,"."));
$f_ext = strrev($ext);
if(( strcasecmp($f_ext, $type) == 0 )) $files++;
}
closedir($dh);
return $files;
}
// here the function ends

now (when included in a WordPress Theme) one can use it - example:

$rome = CountImages("/images/rome/", "jpg")
now the number of jpg files is stored in $rome
In the WordPress Sidebar you can output this value with
<?php echo $rome; ?>

2) why not? you uploaded an image into a directory, so you have a normal absolute path to it that you can write into an img-element as src. although using a big sized image in wordpress posts leads to no sense to open the folderblog gallery

3) you have a folder containing all of your thumbs - only thing you need is this: http://www.alistapart.com/articles/betterrotator/
or even smaller http://www.alistapart.com/articles/randomizer/

clicking on my name below this entry, leads you to my rotate.php that is placed within the same folder as the thumbs
posted by erik on 17 Aug 05 at 2:39 AM
Erik,

Thank you. However, I am not a programmer so sorry about this stupid question.

Where do I place the code scrap to count images? How do I include it in the theme so that I can call it from sidebar.php?
posted by agiacosa on 17 Aug 05 at 6:13 AM
You can't use folderblog tags in anything else but folderblog, but you can simply link to a folderblog category in a WordPress theme sidebar.php with something like:

<li>
<h2><?php _e('Folderblog Categories'); ?></h2>
<ul>
<li><a href="path_to/fb.php/cat_name/">My Category Name</a></li>
<li><a href="path_to/fb.php/cat_name/archives/">My Category Archive</a></li>
</ul>
</li>

Where path_to is the full URI to the fb.php file and cat_name is the folder name that appears in the Address Bar of your browser when viewing that category in folderblog. You can either link to the big image (the first link in the example above) or the category's archive (the second example link). Make a link to each category you have in folderblog in this way, and you're done.
posted by Elwing on 18 Aug 05 at 8:59 AM
Post a Reply:

Name:    Remember me
URL:    
(include http:// or mailto:)
(back to index)