<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Einar Egilsson &#187; ZenPhoto</title>
	<atom:link href="http://einaregilsson.com/category/zenphoto/feed/" rel="self" type="application/rss+xml" />
	<link>http://einaregilsson.com</link>
	<description>A site for my programming pet projects</description>
	<lastBuildDate>Fri, 10 Feb 2012 09:54:49 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3</generator>
		<item>
		<title>ZenPhoto Uploader</title>
		<link>http://einaregilsson.com/zenphoto-uploader/</link>
		<comments>http://einaregilsson.com/zenphoto-uploader/#comments</comments>
		<pubDate>Mon, 20 Jul 2009 20:47:29 +0000</pubDate>
		<dc:creator>einar</dc:creator>
				<category><![CDATA[C#]]></category>
		<category><![CDATA[ZenPhoto]]></category>

		<guid isPermaLink="false">http://tech.einaregilsson.com/?p=255</guid>
		<description><![CDATA[The photo album software I use to store my photos on the web is ZenPhoto. It is a very nice photo gallery system, with themes, lots of plugins, nice administrative interface and plenty of other good stuff. The only problem I had with it was getting my photos uploaded. Sure, they offer a web interface, [...]]]></description>
			<content:encoded><![CDATA[<p>The photo album software I use to store my photos on the web is <a href="http://zenphoto.org">ZenPhoto</a>. It is a very nice photo gallery system, with themes, lots of plugins, nice administrative interface and plenty of other good stuff. The only problem I had with it was getting my photos uploaded. Sure, they offer a web interface, or you can upload a zip file, or use FTP but I usually need to preprocess my photos a bit. Rotate them, throw out the ones I don&#8217;t want to upload, and most of all I need to make them smaller, uploading them in the size I use on my camera takes forever. So, I decided to make a simple program to do these things for me.<br />
<span id="more-255"></span><br />
I had previously used the program <a href="http://www.ornj.net/webalbum/">Web Album Generator</a> to make static html albums. I really liked its interface so I mostly copied it for my own program, ZenPhoto Uploader. Theres a list of the images on the left side and on the right side is a toolbar with all available operations, a big preview screen and textboxes for adding titles and descriptions.<br />
<a href="http://einaregilsson.com/wp-content/uploads/2009/07/zp.jpg"><img class="aligncenter size-medium wp-image-256" title="ZenPhoto Uploader screenshot" src="http://einaregilsson.com/wp-content/uploads/2009/07/zp-300x224.jpg" alt="" width="300" height="224" /></a></p>
<p>The program is ONLY meant for uploading albums for the first time, not for working with albums once they are uploaded. The main features of the program are:</p>
<ul>
<li>Create new albums (with descriptions) and upload images (obviously)</li>
<li>Resize photos before uploading</li>
<li>Rotate photos</li>
<li>Order photos in album</li>
<li>Remove photos from album and optionally delete the file itself</li>
<li>Save titles and descriptions for photos</li>
<li>Keyboard shortcuts for almost all actions</li>
</ul>
<p>The program is very much &#8220;me-ware&#8221;. I made it to scratch my own itch, it may not fit or feel right to anyone else. It was thrown together and is fixed as I run into bugs while using it. It may well contain errors and might crash horribly. That said, everyone is welcome to use it and improve upon it if they wish. Just know that <strong>you are using this at your own risk. I cannot be held liable for any damages or problems this program may cause. It contains commands that you can use to delete photos from your hard disk, use it carefully and think about what you are doing</strong>.</p>
<p>Probably my favorite feature of the program is the ability to do everything from the keyboard. The available shortcuts are:</p>
<ul>
<li>CTRL+U: Open the upload dialog</li>
<li>CTRL+UP, CTRL+DOWN: Move to previous/next photo even though the listbox is not selected</li>
<li>CTRL+SHIFT+UP, CTRL+SHIFT+DOWN: Move a photo higher or lower in the list</li>
<li>CTRL+T: Give focus to the Title textbox</li>
<li>CTRL+D: Give focus to the Description textbox</li>
<li>CTRL+LEFT, CTRL+RIGHT: Rotate the currently selected photo</li>
<li>DEL: Remove or delete the currently selected photo. There is a confirmation dialog that asks if you want to remove the photo from the album, or delete the photo. Do not choose &#8220;delete&#8221; unless you really want to delete the photo from your hard disk forever!</li>
</ul>
<p>You can <a href="/download/ZenPhotoUploader.zip">download the source here</a>, it is licensed under the <a href="http://www.gnu.org/licenses/gpl-3.0.html">GPL v3.0</a>. It is written in C# and requires .NET 3.5 to compile. There is a build.bat file in the root folder that can be used to build the program.</p>
<p>Finally, you can <strong><a href="/download/ZenPhotoUploader.exe">DOWNLOAD ZenPhotoUploader</a></strong> here, it is a single executable, no dependencies other than the .NET framework 2.0 or higher. The only version of ZenPhoto I&#8217;ve tested it against is v1.2.2, others may not work. Enjoy, and let me know if you have any problems with it.</p>
]]></content:encoded>
			<wfw:commentRss>http://einaregilsson.com/zenphoto-uploader/feed/</wfw:commentRss>
		<slash:comments>9</slash:comments>
		</item>
		<item>
		<title>Using WordPress authentication in Zenphoto</title>
		<link>http://einaregilsson.com/using-wordpress-authentication-in-zenphoto/</link>
		<comments>http://einaregilsson.com/using-wordpress-authentication-in-zenphoto/#comments</comments>
		<pubDate>Wed, 08 Aug 2007 08:18:15 +0000</pubDate>
		<dc:creator>einar</dc:creator>
				<category><![CDATA[Code]]></category>
		<category><![CDATA[Wordpress]]></category>
		<category><![CDATA[ZenPhoto]]></category>

		<guid isPermaLink="false">http://tech.einaregilsson.com/2007/08/08/using-wordpress-authentication-in-zenphoto/</guid>
		<description><![CDATA[In a previous post I talked about how to integrate ZenPhoto into WordPress. After I had done that for my own site I still wasn&#8217;t happy. I didn&#8217;t like the fact that I had to use seperate logins for WordPress and ZenPhoto, I wanted this to be as integrated as possible. So I figured out [...]]]></description>
			<content:encoded><![CDATA[<p>In a previous post I talked about <a href="http://einaregilsson.com/2007/08/06/integrating-zenphoto-into-wordpress/">how to integrate ZenPhoto into WordPress</a>. After I had done that for my own site I still wasn&#8217;t happy. I didn&#8217;t like the fact that I had to use seperate logins for WordPress and ZenPhoto, I wanted this to be as integrated as possible. So I figured out a way to make ZenPhoto ask WordPress for authentication credentials. In other words, if you&#8217;re logged into WordPress, you&#8217;re also logged into ZenPhoto. This makes the user/password in the ZenPhoto config file meaningless. Here&#8217;s what you have to do to get this working:<span id="more-39"></span></p>
<p>1. Edit the file auth_zp.php under the zen folder in your ZenPhoto installation, throw away everything in the file, and replace it with this:</p>
<pre class="brush: php; title: ; notranslate">
&lt;?php
require_once(&quot;functions-db.php&quot;);

$wp_include = &quot;../wp-config.php&quot;;
$i = 0;
while (!file_exists($wp_include) &amp;&amp; $i++ &lt; 10) {
  $wp_include = &quot;../$wp_include&quot;;
}
require_once($wp_include);

function zp_loggedin() {
  //Only considered logged in if it's someone with more rights
  //than a Subscriber
  return is_user_logged_in() &amp;&amp; wp_get_current_user()-&gt;user_level &gt;= 2;
}

if (isset($_GET[&quot;logout&quot;]) || isset($_POST[&quot;logout&quot;])) {
  header(&quot;Location: &quot; . get_option(&quot;siteurl&quot;)
       . &quot;/wp-login.php?action=logout&quot;);
  exit();
}

?&gt;;
</pre>
<p>This technique assumes that your Zenphoto folder is a subfolder of your WordPress folder. Like here, my WordPress install is at http://einaregilsson.com/ and my Zenphoto install is at http://einaregilsson.com/photos/. It can be at most 10 levels deep in the folder hierarchy under WordPress, but it MUST be under the WP folder. </p>
<p>2. Edit the admin-function.php file thats also under the zen folder in your ZenPhoto installation. Find the function printLoginForm and replace it with this:</p>
<pre class="brush: php; title: ; notranslate">
function printLoginForm($redirect=&quot;/zen/admin.php&quot;) {
  if (is_user_logged_in() &amp;&amp; wp_get_current_user()-&gt;user_level == 0) {
    //User is logged in as Subscriber

    $logoutUrl = get_option('siteurl') . &quot;/wp-login.php?action=logout&quot;;
    echo &quot;&lt;p&gt;&lt;img src=\&quot;../zen/images/zen-logo.gif\&quot; title=\&quot;Zen Photo\&quot; /&gt;&lt;/p&gt;&quot;;

    echo &quot;\\n  &lt;div id=\&quot;loginform\&quot;&gt;&quot;;
    echo &quot;&lt;div class=\&quot;errorbox\&quot; id=\&quot;message\&quot;&gt;&quot;
       . &quot;&lt;h2&gt;Error: Insufficient privileges.&lt;/h2&gt;&quot;
       . &quot;You are currently logged into WordPress as a &lt;strong&gt;Subscriber&lt;/strong&gt;. &quot;
       . &quot;Subscribers can't access ZenPhoto Administration. In order to do &quot;
       . &quot;so you must &lt;a href=\&quot;$logoutUrl\&quot;&gt;log out of WordPress&lt;/a&gt; and &quot;
       . &quot;then log in again with an account that has more rights.&quot;
       . &quot;&lt;/div&gt;&quot;;
    echo &quot;\\n&lt;/body&gt;&quot;;
    echo &quot;\\n&lt;/html&gt;&quot;;
  } else {
    $redirect = WEBPATH . $redirect;
    header(&quot;Location: &quot;.get_option('siteurl').&quot;/wp-login.php?redirect_to=$redirect&quot;);
    exit();
  }
}
</pre>
<p>The only tricky thing here was dealing with WordPress users that only have Subscriber rights. Subscribers shouldn&#8217;t be able to administer ZenPhoto of course, but I didn&#8217;t want to log them out automatically or anything. So I added a special case for them, if a Subscriber tries to access ZenPhoto Administration he will get an error message saying he needs to log in with higher privileges and link to log out of WordPress. If you already have the basic <a href="http://einaregilsson.com/2007/08/06/integrating-zenphoto-into-wordpress/">ZenPhoto integration</a> working then you&#8217;ll have the ZenPhoto link in your WordPress admin pages. Subscribers however won&#8217;t see this link, it will only be shown to users with a role of Contributor or higher.</p>
<p>And that&#8217;s it. Now I have my photos using my WordPress theme, I can edit them in my WordPress admin, I have a link to the ZenPhoto admin and I can use WordPress authentication. The integration is complete <img src='http://einaregilsson.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' />  .</p>
]]></content:encoded>
			<wfw:commentRss>http://einaregilsson.com/using-wordpress-authentication-in-zenphoto/feed/</wfw:commentRss>
		<slash:comments>6</slash:comments>
		</item>
		<item>
		<title>Integrating ZenPhoto into WordPress</title>
		<link>http://einaregilsson.com/integrating-zenphoto-into-wordpress/</link>
		<comments>http://einaregilsson.com/integrating-zenphoto-into-wordpress/#comments</comments>
		<pubDate>Mon, 06 Aug 2007 00:28:46 +0000</pubDate>
		<dc:creator>einar</dc:creator>
				<category><![CDATA[Plugins]]></category>
		<category><![CDATA[Wordpress]]></category>
		<category><![CDATA[ZenPhoto]]></category>

		<guid isPermaLink="false">http://tech.einaregilsson.com/2007/08/06/integrating-zenphoto-into-wordpress/</guid>
		<description><![CDATA[ZenPhoto is a great image gallery written in php that I use on another page I have. It has a great admin interface and themes that are simple to use. I wanted to integrate it into a WordPress blog so I looked around on the net and found a great article about it by a [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://zenphoto.org">ZenPhoto</a> is a great image gallery written in php that I use on another page I have. It has a great admin interface and themes that are simple to use. I wanted to integrate it into a WordPress blog so I looked around on the net and found a great article about it by a guy named <a href="http://ruzee.com">Steffen Rusitschka</a>. It explains how you can get your ZenPhoto gallery to look like your blog by including some WordPress pages in your ZenPhoto theme. The article is at <a href="http://www.ruzee.com/blog/2006/06/integrating-zenphoto-into-wordpress/">http://www.ruzee.com/blog/2006/06/integrating-zenphoto-into-wordpress/</a>.</p>
<p>His method works great but there were a few things that bugged me about it. <span id="more-42"></span>First, my ZenPhoto javascript didn&#8217;t work with it, so the inline editing of album descriptions didn&#8217;t work. Also I wanted to be able to edit my ZenPhoto theme files in the WordPress theme editor. I tweak my theme all the time and I thought it would be much more convenient to be able to do it all in one place. So I figured out a way to make it work. Steffen gets full credit for coming up with the method, my contribution is simply making the javascript and theme editor work correctly, creating a link to the ZenPhoto admin interface from the WordPress admin interface and packing it all up in a zip file with easy installation instructions. I won&#8217;t explain all the code here, it&#8217;s done quite nicely in Steffens article but for those interested in the implementation it&#8217;s basically this:</p>
<ol>
<li>Make the files in the ZenPhoto theme basically do nothing but include zp-index, zp-image and zp-album from the current WordPress theme folder. This allows us to edit the theme using the WordPress theme editor.</li>
<li>Add hooks in WordPress so the ZenPhoto stylesheet will be included in the &lt;head&gt; element of the page.</li>
<li>Add hooks in WordPress so the zenJavascript function from ZenPhoto is called on the pages, so the inline editing will work (see head.php for this).</li>
<li>Create a small WordPress plugin that creates a link to ZenPhoto from the WordPress admin interface, and gives the zp files pretty names in the WordPress theme editor (&#8216;ZenPhoto Index&#8217; for zp-index.php, &#8216;ZenPhoto Image&#8217; for zp-image.php etc.).</li>
</ol>
<p>For those that just want to get it working, here are the installation instructions:</p>
<ol>
<li>Download the zip file and unzip.</li>
<li>Copy the wordpress-integration-zp-theme folder into your zenphoto/themes folder.</li>
<li>Go to your ZenPhoto admin web, choose Options and activate the theme called &#8216;WordPress Integration Theme&#8217;.</li>
<li>Copy the files (zp-index.php, zp-image.php, zp-album.php, zp-style.css) from the wordpress-theme-files folder into your current WordPress theme folder, /wp-content/themes/yourthemename.</li>
<li>Copy the zen-integration.php file into your WordPress plugin folder, /wp-content/plugins .</li>
<li>Goto your WordPress admin interface, choose Plugins, and activate the &#8216;Zen Integration&#8217; plugin. Note that the plugin assumes that your zenphoto folder is directly below your WordPress folder and is called &#8216;zenphoto&#8217;, &#8216;photos&#8217; or &#8216;gallery&#8217;. If it&#8217;s not, and you want to get the ZenPhoto link from the WordPress admin interface working you&#8217;ll need to edit the zen-integration.php file, find this line:
<pre class="brush: php; title: ; notranslate">$zp_admin_url = ''</pre>
<p>And change it to the full url of your ZenPhoto admin page, e.g.</p>
<pre class="brush: php; title: ; notranslate">$zp_admin_url = 'http://example.com/foo/bar/zenphoto/zen/admin.php'</pre>
<li>There is no step 7, you&#8217;re done!</li>
</ol>
<p>Now you should be able to go to your WordPress theme editor and see the files &#8216;ZenPhoto Index&#8217;, &#8216;ZenPhoto Album&#8217;, &#8216;ZenPhoto Image&#8217; and &#8216;ZenPhoto Stylesheet&#8217; and you can edit them right there. The files included in the zipfile are meant to be used with the default WordPress theme, Kubrick, and will probably not look very good on any other theme. It&#8217;s the simplest thing I could come up with, I mostly just changed the default ZenPhoto theme a bit. You should change it to fit your current WordPress theme. In the files, the ZenPhoto part is always wrapped in a &lt;div id=&#8221;zenphoto&#8221;&gt;, and the ZenPhoto stylesheet prefixes everything with #zenphoto, this is so your ZenPhoto stylesheet won&#8217;t start affecting other parts of your blog.</p>
<p>So, that&#8217;s it I think <img src='http://einaregilsson.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' />  . You can <a href="/download/zen-integration.zip">download the zip file with all the needed file here</a>, let me know if you have any problems with it. You can view it in action at <a href="/photos">http://einaregilsson.com/photos</a>  (Yes, I know it&#8217;s the same picture over and over, it&#8217;s just for demonstration purposes <img src='http://einaregilsson.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' />  ).</p>
<p><strong>UPDATE 01.09.2007:</strong> Fixed bug where error message didn&#8217;t appear when comment was invalid on an image page.<br />
<strong>UPDATE 02.09.2007:</strong> &#8230;and now I fixed the fix, because it was displaying the error message even if there was no error!</p>
]]></content:encoded>
			<wfw:commentRss>http://einaregilsson.com/integrating-zenphoto-into-wordpress/feed/</wfw:commentRss>
		<slash:comments>71</slash:comments>
		</item>
	</channel>
</rss>

