Placing Thumbnails in the Loop: The Old Method
If you’re familiar with the original Mimbo, you’ll already know how custom fields are used to associate thumbnail images with posts. Essentially, your posts are queried via the Loop, and if the custom field Key (”Image”) has a value, that value is fed into an <img> tag. The free version of Mimbo displays it like this:
<?php
//Check if custom field key "Image" has a value
$values = get_post_custom_values("Image");
if (isset($values[0])) {
?>
<img src="<?php bloginfo('template_url'); ?>/images/<?php $values = get_post_custom_values("Image"); echo $values[0]; ?>" alt="" />
<?php } ?>
The resulting image path looks like this.
The New Method
One big change we made with Mimbo Pro was relying on Worpdress’s image upload tool rather than FTP, so that you can configure your own /upload/ folder and copy the path easily. Once you’ve uploaded an image, you click ‘Edit’…

… and copy the path…

…and then paste its value alongside a Key you’ve created called “Image”:

After that, you’re ready to publish. See also the video tutorial.
Note: If Mimbo Pro is not installed in the root of your site, you may have to alter that image path so the thumb script can find it.
How do the images Get Re-sized?
In the past, users had to manually crop and resize images with image-edit software. Mimbo Pro comes with an open-source script called TimThumb which resizes images on the fly. Throughout the theme, you’ll see code like this:
<?php
//Check if custom field key "Image" has a value
$values = get_post_custom_values("Image");
if (isset($values[0])) {
?>
<img src="<?php echo bloginfo('template_url'); ?>/scripts/timthumb.php?src=/<?php
$values = get_post_custom_values("Image"); echo $values[0]; ?>&w=150&h=175&zc=1"
alt="<?php the_title(); ?>" />
<?php } ?>
The resulting image path looks like this. Tip: depending on your encoding, you’ll need to use the character entity reference ‘&’ instead of ‘&’ to validate your pages properly.
How Else is it Used?
The image gallery packaged with Mimbo Pro works on this same logic — it loops through posts, determines if there is custom-field data, and if so, publishes the last 12 posts, aka, images. It’s not a traditional thumbnail gallery meant for viewing different sizes, but more like a visual way of navigating the archives.
Additionally, the search template checks for custom fields when it returns results. For me, the inclusion of images helps to jog the memory when searching for something I can’t remember well.
Next tutorial, I’ll cover the code that displays category archives chronologically in three different styles. This keeps your archives from being a flat, linear list, and treats them more like a section ‘homepage’, ala the New York Times‘ Sports page.
Popularity: 2% [?]
I’m in the process of converting a site to mimbo pro and I installed wordpress in the directory wp - I am trying to associate images with posts and so far haven’t got one to work. It seems like it should work if I use the path wp/wp-content… but it doesn’t. What am I missing?
--April 14, 2008 @ 10:53 amGreat tutorial! Thanks!
To Judith: I just finished working on this and had a problem with it too. It appears that you cannot upload pics via ftp into a file. When I tried to do this, the pics just wouldn’t show. Once I uploaded the pic via Wordpress in the edit or write post area and entered the specific path:
--April 21, 2008 @ 6:16 pmwp/wp-content/uploads/2008/04/picture1.jpg
the pic showed up. Good luck and contact me through my site if you need help.