<?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>Bill Shupp &#187; Boobs</title>
	<atom:link href="http://blog.shupp.org/category/boobs/feed/" rel="self" type="application/rss+xml" />
	<link>http://blog.shupp.org</link>
	<description>Software engineer, musician, space enthusiast</description>
	<lastBuildDate>Fri, 03 Feb 2012 22:00:58 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.2.1</generator>
<atom:link rel="hub" href="http://pubsubhubbub.appspot.com"/><atom:link rel="hub" href="http://superfeedr.com/hubbub"/>		<item>
		<title>MogileFS, Zend Framework, Boobs, and Kittens</title>
		<link>http://blog.shupp.org/2010/02/10/mogilefs-zend-framework-boobs-and-kittens/</link>
		<comments>http://blog.shupp.org/2010/02/10/mogilefs-zend-framework-boobs-and-kittens/#comments</comments>
		<pubDate>Thu, 11 Feb 2010 06:37:24 +0000</pubDate>
		<dc:creator>shupp</dc:creator>
				<category><![CDATA[Boobs]]></category>
		<category><![CDATA[Code]]></category>
		<category><![CDATA[Kittens]]></category>
		<category><![CDATA[MogileFS]]></category>
		<category><![CDATA[PEAR]]></category>
		<category><![CDATA[Zend Framework]]></category>

		<guid isPermaLink="false">http://blog.shupp.org/?p=25</guid>
		<description><![CDATA[An upcoming side project of mine requires the use of MogileFS and Zend Framework.  MogileFS is an open source distributed file system, meant to scale up to many millions of files without a single point of failure.  It's currently used by the likes of Digg and last.fm. Though I was already familiar with using MogileFS [...]]]></description>
			<content:encoded><![CDATA[<p>An upcoming side project of mine requires the use of <a title="MogileFS" href="http://www.danga.com/mogilefs/">MogileFS</a> and <a title="Zend Framework" href="http://framework.zend.com">Zend Framework</a>.  MogileFS is an open source distributed file system, meant to scale up to many millions of files without a single point of failure.  It's currently used by the likes of <a title="Digg" href="http://digg.com">Digg</a> and <a title="last.fm" href="http://last.fm">last.fm</a>.</p>
<p>Though I was already familiar with using MogileFS clients in <a title="File_Mogile" href="http://pear.php.net/package/file_mogile/redirected">php</a> and <a href="http://www.albany.edu/~ja6447/mogilefs.py">python</a> at work, the operations team actually runs the servers.   I wanted to get some experience with managing MogileFS itself (trackers, mogstored, mysql), and hopefully have a better understanding of how it all worked together.  While I was already familiar with Zend Framework, I'd never used it to serve images.  So, I figured I should build a quick prototype using both.  But what to build?  I decided to take inspiration from the notorious <a title="Explosions and Boobs" href="http://explosionsandboobs.com">http://explosionsandboobs.com</a>, but put my own spin on it.  The result?</p>
<p><a href="http://boobsandkittens.com">http://boobsandkittens.com</a><span id="more-25"></span></p>
<p>Bear in mind that the above URL is on my inexpensive <a title="Slicehost" href="http://slicehost.com">Slicehost</a> VPS, and can be slow at times.  This is a really simple application that allowed me to do a few things:</p>
<ul>
<li>scrape some content from google images search</li>
<li>store them in MogileFS</li>
<li>render the stored images through ZF</li>
</ul>
<p>The source is available <a title="Boobs and Kittens Source" href="http://github.com/shupp/bandk">here</a>.  The <a title="google images scraper" href="http://github.com/shupp/bandk/blob/master/application/cli/scrape.php">scraper</a> is pretty straight forward.  I just called it from the command line to save images to a directory.  Once saved to disk, I used the <a title="mogrify" href="http://www.imagemagick.org/script/mogrify.php">mogrify</a> tool from Imagemagick to scale the images down to a height of 400 px max, and visually removed the worst of the images (it's relatively SFW).  Next, I inserted those images into MogileFS with <a title="insertImage.php" href="http://github.com/shupp/bandk/blob/master/application/cli/insertImage.php">insertImage.php</a>.  There are only two real action controllers, the <a href="http://github.com/shupp/bandk/blob/master/application/controllers/IndexController.php">index page</a> and <a href="http://github.com/shupp/bandk/blob/master/application/controllers/ImageController.php">image renderer</a>.  The latter was really the only thing to learn on the php side of this project.  The key there was disabling the layout and view rendering, as well as setting the appropriate image information in the response object (content-type, content-length, and the content itself).  Since most of the logic is in the <a href="http://github.com/shupp/bandk/blob/master/application/models/Model/Images.php">model</a>, the action controllers are pretty skinny.  I used memcache to store db queries and the images from MogileFS to help offset the performance of a cheap VPS.  Since Zend Framework doesn't ship with a MogileFS client, I used the <a href="http://pear.php.net/package/file_mogile/redirected">PEAR</a> one.</p>
<p>That's it.  Enjoy!</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.shupp.org/2010/02/10/mogilefs-zend-framework-boobs-and-kittens/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

