I wish I could go back and change the past, but I can’t, so this is where we stand. At least we have memories.
All photos and editing herein by Richard X. Thripp, Aug-Dec 2008.
I wish I could go back and change the past, but I can’t, so this is where we stand. At least we have memories.
All photos and editing herein by Richard X. Thripp, Aug-Dec 2008.
I was looking for ways to optimize my website . . . to make it quicker and easier for me to maintain and update, while being fun to browse for my visitors. The problem with the old gallery and random photos at the top of each page, was that I had to make the thumbnails and update the page and database for both (I was using the this randomizer plugin for Wordpress), each time I added a photo. It was good because I’d crop, scale down, and sharpen each image to look its best, but the extra work was too much. I found the Post Thumb plugin is the perfect solution. I installed it, set it to make 100×70 thumbnails, and then added this code to my blog header:
<?php the_random_thumb(”link=p&limit=5&category=8″); >
That makes it show five random photos from the category for my photos, linking to the page for each instead of the file. The great thing here is that the thumbnail folder and accompanying MySQL table is updated automatically, so photos are added to the pool as soon as I publish them. A random photos section is good for the casual browser, who just looks at what catches his eye.
Next, I wanted to create a dynamic gallery and random image page. I added the Exec-PHP plugin so I could use PHP code in pages and posts, but found that Wordpress inserts a line break between each thumbnail, against my wishes. For that, I added this modified version of Text Control by Jeff Minard, then setting it to not auto-format the gallery and random pages.
The code for page one of the gallery is:
<?php the_recent_thumbs(”subfolder=g&width=200&height=160&link=p&limit=60&category=8″); ?>
and for page two:
<?php the_recent_thumbs(”subfolder=g&width=200&height=160&link=p&limit=60&offset=60&category=8″); ?>