Installing Zenphoto on 1and1

zen-logo

I had all kinds of trouble getting Zenphoto to install on 1and1. None of which I believe are the fault of the Zenphoto project. I am blaming the difficulties on how you need to configure php on 1and1.

What problems did I have. It appears that there were tables that were not created correctly. The way I figured this out was that I was trying to save a ¬†guest user and password to¬†and album. The name wouldn’t stick. When I went in and look under the MySql admin¬†tool (phpMyAdmin), there was no user field in the albums table. Something was wrong right from setup.

So here are the steps that I came up with to get zenphoto installed properly. I can’t say that all of the steps I took were necessary, and some might even be suspect, but in total it works.

Continue reading

Integrating with WordPress

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’t use as well. I think I have settled on zenphoto. It seems to work pretty well, with out the feature creep that Gallery2 has. I figured I would convert the annieandchris.net site to that.

It got me thinking though about how I might integrate it with WordPress. After seeing the tantan Flickr 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’s presszen looked promising, but it didn’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.

function parse_query(&$query) {
	$query->is_404 = false;
	$query->did_permalink = false;
}
function request($query_vars) {
    $query_vars['error'] = false;
    return $query_vars;
}

function cww_template() {
	get_header();
	echo '

Zen Integration

'; get_footer(); exit; } define("CWW_ZEN_BASEURL", "/blog/test"); if (strpos($_SERVER['REQUEST_URI'], CWW_ZEN_BASEURL) === 0) { status_header(200); remove_action('template_redirect', 'redirect_canonical'); add_filter('request', 'request'); add_action('parse_query', 'parse_query'); add_action('parse_request', 'parse_query'); add_action('template_redirect', 'cww_template'); } elseif (strpos($_SERVER['REQUEST_URI'].'/', CWW_ZEN_BASEURL) === 0) { header('location: http://'.$_SERVER['HTTP_HOST'].$_SERVER['REQUEST_URI'].'/'); exit; } ?>

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 ‘exit’ the script to prevent the loop from happening. You would think you could override a WordPress function to prevent that instead.