<?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>Random Musings&#187; php</title> <atom:link href="http://www.nslms.com/category/software-development/php/feed/" rel="self" type="application/rss+xml" /><link>http://www.nslms.com</link> <description></description> <lastBuildDate>Wed, 06 Jul 2011 20:47:34 +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>How to resize billions of images in the cloud</title><link>http://www.nslms.com/2010/11/01/how-to-resize-billions-of-images-in-the-cloud/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=rss</link> <comments>http://www.nslms.com/2010/11/01/how-to-resize-billions-of-images-in-the-cloud/#comments</comments> <pubDate>Mon, 01 Nov 2010 17:11:44 +0000</pubDate> <dc:creator>RyanG</dc:creator> <category><![CDATA[Cloud computing]]></category> <category><![CDATA[Linux]]></category> <category><![CDATA[php]]></category> <category><![CDATA[linkedin]]></category> <guid
isPermaLink="false">http://www.nslms.com/?p=750</guid> <description><![CDATA[As I was clearing out my RSS reader a few days back, I stopped to read a post on the Flickr dev blog about the &#8220;new&#8221; 640px image size. In the article they lament that they wished they had made &#8220;Large&#8221; copies of all uploaded images because it would make generating the new 640px size [...]]]></description> <content:encoded><![CDATA[<div
class="tweetmeme_button" style="float: right; margin-left: 10px;"> <a
href="http://api.tweetmeme.com/share?url=http%3A%2F%2Fwww.nslms.com%2F2010%2F11%2F01%2Fhow-to-resize-billions-of-images-in-the-cloud%2F"><br
/> <img
src="http://api.tweetmeme.com/imagebutton.gif?url=http%3A%2F%2Fwww.nslms.com%2F2010%2F11%2F01%2Fhow-to-resize-billions-of-images-in-the-cloud%2F&amp;source=rjgeyer&amp;style=normal&amp;service=bit.ly&amp;b=2" height="61" width="50" /><br
/> </a></div><p>As I was clearing out my RSS reader a few days back, I stopped to read a post on the Flickr dev blog about the &#8220;new&#8221; <a
href="http://code.flickr.com/blog/2010/10/26/the-not-so-new-image-size-medium-640/">640px image size</a>.  In the article they lament that they wished they had made &#8220;Large&#8221; copies of all uploaded images because it would make generating the new 640px size easier.</p><p>This got me thinking, what if they did want to convert every image ever uploaded to this new size and cache it?  How would they do it? How much would it cost?  The more I thought about it, the more curious I became, so I launched a little research project to see what I could find out, and to show how I would work through the problem.</p><h1>Approach</h1><h2>How to resize?</h2><p>I tried searching to find out exactly how Flickr is resizing their images, but it is apparently a well kept secret.  There was a fair amount of speculation that they use Lanczos resampling, and my own research suggested it was a strong choice for quality resizing, so I chose to use it for the purposes of this experiment.</p><p>I wrote a very quick PHP script that uses ImageMagick with the Lanczos &#8220;filter&#8221; to do the work.  This resizer was built with this particular experiment in mind, but it is fairly flexible.  If you POST an image, and a value &#8220;largestDimInPx&#8221; it will resize the image and send it back as the response to the HTTP POST, thus the &#8220;RESTFul&#8221; name.  The resizer also accepts an array of parameters which it sends back in the HTTP header.  So if you were actually taking on a mass resizing project like we&#8217;re proposing, you can pass the unique ID of the photo in your system and get it back when the resize is complete.</p><p>You can find the code for it over on my <a
href="http://github.com/rgeyer/RESTful-PHP-Resizer">GitHub</a>.</p><h2>Just how many images we talkin&#8217;?</h2><p>Another carefully guarded secret it seems, is the total number of images that Flickr is currently hosting.  I did a lot of searching and tried a few naughty tricks to see if I could get the API or website to tell me, but it was to no avail.</p><p>Some previous &#8220;official&#8221; numbers were as high as 6 <em>billion</em> images.  So for the purposes of my test I assumed that they had 10 <em>billion</em> images that they wanted to resize to this new 640px image size.</p><h2>CPU Cycles &#8211; Pick your poison</h2><p>I have to assume that Flickr has a pretty impressive infrastructure built out, and that they have a huge amount of processing power at their disposal.  Still, to accomplish something like this it&#8217;s unlikely that they&#8217;d reallocate existing resources.  The task is too monumental to just have a couple servers work at it.</p><p>I also have to assume that they&#8217;re carefully optimizing their servers so that they don&#8217;t have to build and maintain more than necessary.  So that begs the question, how do you get the processing horsepower necessary to convert all of these images?</p><p>Since I&#8217;ve recently been engrossed in creating and refining reusable <a
href="http://www.rightscale.com/library/">RightScale ServerTemplates<a
/> for our own servers in the </a><a
href="http://aws.amazon.com/">AWS cloud</a>, my thoughts for a solution instantly gravitated toward launching a bunch of servers in the cloud for this purpose then terminating them when the task was done.  What I didn&#8217;t know is if this made more sense than, say, buying a bunch of servers and configuring them to do the same task.</p><p>In order to do some tests, I created <a
href="">ServerTemplate</a> which can be launched on AWS using RightScale that will immediately be able to start resizing images posted to it using my aforementioned PHP resizer.</p><h1>The experiment</h1><p>What I learned in short was&#8230;  This is a <b><em>HUGE</em></b> undertaking!  I also found that while any approach would probably be cost prohibitive, performing this resizing task using on-demand servers in the cloud is still the cheapest route by far.</p><h2>Assumptions</h2><p>First, some of the assertions for this exercise.</p><ul><li>The server(s) performing the resize task will be of the <a
href="http://aws.amazon.com/ec2/instance-types/">m1.large</a> type from AWS</li><li>Flickr has 10 <em>billion</em> images to convert</li><li>Those images are (on average 12MP and about 4MB</li><li>The images are being resized so that the largest dimension is 640px</li></ul><p>You&#8217;ll also find that as I describe the results, and the costs they represent, I conveniently exclude data transfer from my numbers.  This is actually intentional.  My goal is to compare just CPU time.</p><p>Yes, bandwidth has a tangible cost when you use it in the cloud.  But the same is true for a bare metal server doing the same task, not to mention the networking hardware which must be acquired, configured, and maintained.  So for the purposes of this experiment, only the cost of CPU cycles is really being examined.</p><h2>Findings</h2><p>With my new m1.large instance launched in the AWS cloud, and exposing the resizer service, I did a few tests to get a feel for just how long it would take to do all of this resizing.  What I found out pretty quickly was that the actual task of resizing the image actually only took around 1 second, sometimes less!  It should come as no surprise that the real time consumer in the process was I/O bandwidth.</p><p>Over my home cable connection (measures at 3.5Mbps up and 11.83Mbps down), using Firefox to post and FireBug to measure, it took an average of 12 seconds to complete the process of posting the image and receiving the response.  If I removed the overhead of Firefox and simply used a bash script and cURL, that dropped considerably to 8 seconds.</p><p>In an effort to get a &#8220;best case scenario&#8221; measurement, I copied the file to be resized onto the AWS instance, and ran the same cURL command locally.  On what can be effectively called &#8220;infinite&#8221; bandwidth, the process of posting, resizing, and fetching the result took about 2 seconds.</p><h2>The tortoise and the hare</h2><p>One very tangible benefit to using the cloud for this purpose though is the time to market for such a huge task.  You can imagine that if Flickr did decide to go ahead with this, they wouldn&#8217;t really want to announce that they&#8217;ve started but that the process will take many months, or even years.  Assuming again that the per image resize time is 2 seconds, it would take one server just over 633 <strong>years</strong> to convert all of the images.  Something tells me that wouldn&#8217;t exactly go over well.</p><p>Say that they wanted to convert all of the images in one week, at 2 seconds per image for 10B images, it would require just over 33,000 servers to convert that many images in the cloud.  What&#8217;s more is that it would take effectively &#8220;no time&#8221; to deploy that many servers, use them for a week, then terminate them.  Try rolling out that many real, bare metal servers in that timeframe!</p><h2>What&#8217;s it gonna cost?</h2><p>You might look at those results and think that these times are fairly reasonable.  However, if you take these figures and start multiplying them by ludicrously large numbers (like 10 <em>billion</em> for example), those reasonable numbers start to look very unreasonable.</p><p>Using these results, and (as I stated before) only accounting for CPU time, it would cost approximately $1.9M for Flickr to convert all of their images in the cloud.  That is assuming that they&#8217;re connecting to the servers with effectively infinite bandwidth, ensuring that the upload and download transfer times for the image were less than 1 second (combined!).  Seems like a lot of money, but then it&#8217;s a lot of images!</p><p>Compare that though, to building out a farm of bare metal servers to do the same task.  We&#8217;ve already established that we&#8217;d need a little over 33,000 servers to be able to convert all of the images in a week.  If we just take the lowest configuration Dell rack mounted server, the <a
href="http://configure.us.dell.com/dellstore/config.aspx?c=us&#038;cs=555&#038;l=en&#038;oc=MLB1931&#038;s=biz">R-415</a> at a retail price of $4531, it would cost just over $149M, just for the hardware.  Worse still, the Dell doesn&#8217;t actually have as much processing horsepower as an AWS m1.large does, so you&#8217;d probably significantly effect the time per image.</p><h1>Conclusion</h1><p>At the end of the day, any approach for converting all of those images would be cost prohibitive, and I&#8217;m betting Flickr won&#8217;t be taking on this project.  Still, if I had to accomplish this task for real, I think I&#8217;ve demonstrated fairly convincingly that doing it in the cloud with on demand computing power is totally the way to go.</p><p>I&#8217;m not a mathematician or a statistician, and I did paint this topic with very broad strokes.  You can check my work with the simple <a
href="https://spreadsheets.google.com/ccc?key=0AroG_EaGJ08tdHM5Z0syaWJBbkZkWnFqN3c2bFZ6OUE&#038;hl=en">Google Spreadsheet</a> I created to track my results.  If this were an actual task, I&#8217;d be a bit more precise, but I wanted to show the differences between the approaches, without getting into too much minutia.</p><p>That said, discussion about factors I may have missed are welcome, I think you&#8217;ll find that the delta in price for just the CPU horsepower between the cloud and a bare metal solution more than absorb any real differences I may have excluded. <img
src='http://www.nslms.com/wp-includes/images/smilies/icon_wink.gif' alt=';-)' class='wp-smiley' /></p><div
class="shr-bookmarks shr-bookmarks-center"><ul
class="socials"><li
class="shr-blogger"> <a
href="http://www.shareaholic.com/api/share/?title=How+to+resize+billions+of+images+in+the+cloud&amp;link=http://www.nslms.com/2010/11/01/how-to-resize-billions-of-images-in-the-cloud/&amp;notes=As%20I%20was%20clearing%20out%20my%20RSS%20reader%20a%20few%20days%20back%2C%20I%20stopped%20to%20read%20a%20post%20on%20the%20Flickr%20dev%20blog%20about%20the%20%22new%22%20640px%20image%20size.%20%20In%20the%20article%20they%20lament%20that%20they%20wished%20they%20had%20made%20%22Large%22%20copies%20of%20all%20uploaded%20images%20because%20it%20would%20make%20generating%20the%20new%20640px%20size%20easier.%0D%0A%0D%0AThis%20&amp;short_link=&amp;shortener=google&amp;shortener_key=&amp;v=1&amp;apitype=1&amp;apikey=8afa39428933be41f8afdb8ea21a495c&amp;source=Shareaholic&amp;template=&amp;service=219&amp;tags=&amp;ctype=" rel="nofollow" class="external" title="Blog this on Blogger">Blog this on Blogger</a></li><li
class="shr-comfeed"> <a
href="http://www.nslms.com/2010/11/01/how-to-resize-billions-of-images-in-the-cloud/feed" rel="nofollow" class="external" title="Subscribe to the comments for this post?">Subscribe to the comments for this post?</a></li><li
class="shr-facebook"> <a
href="http://www.shareaholic.com/api/share/?title=How+to+resize+billions+of+images+in+the+cloud&amp;link=http://www.nslms.com/2010/11/01/how-to-resize-billions-of-images-in-the-cloud/&amp;notes=As%20I%20was%20clearing%20out%20my%20RSS%20reader%20a%20few%20days%20back%2C%20I%20stopped%20to%20read%20a%20post%20on%20the%20Flickr%20dev%20blog%20about%20the%20%22new%22%20640px%20image%20size.%20%20In%20the%20article%20they%20lament%20that%20they%20wished%20they%20had%20made%20%22Large%22%20copies%20of%20all%20uploaded%20images%20because%20it%20would%20make%20generating%20the%20new%20640px%20size%20easier.%0D%0A%0D%0AThis%20&amp;short_link=&amp;shortener=google&amp;shortener_key=&amp;v=1&amp;apitype=1&amp;apikey=8afa39428933be41f8afdb8ea21a495c&amp;source=Shareaholic&amp;template=&amp;service=5&amp;tags=&amp;ctype=" rel="nofollow" title="Share this on Facebook">Share this on Facebook</a></li><li
class="shr-linkedin"> <a
href="http://www.shareaholic.com/api/share/?title=How+to+resize+billions+of+images+in+the+cloud&amp;link=http://www.nslms.com/2010/11/01/how-to-resize-billions-of-images-in-the-cloud/&amp;notes=As%20I%20was%20clearing%20out%20my%20RSS%20reader%20a%20few%20days%20back%2C%20I%20stopped%20to%20read%20a%20post%20on%20the%20Flickr%20dev%20blog%20about%20the%20%22new%22%20640px%20image%20size.%20%20In%20the%20article%20they%20lament%20that%20they%20wished%20they%20had%20made%20%22Large%22%20copies%20of%20all%20uploaded%20images%20because%20it%20would%20make%20generating%20the%20new%20640px%20size%20easier.%0D%0A%0D%0AThis%20&amp;short_link=&amp;shortener=google&amp;shortener_key=&amp;v=1&amp;apitype=1&amp;apikey=8afa39428933be41f8afdb8ea21a495c&amp;source=Shareaholic&amp;template=&amp;service=88&amp;tags=&amp;ctype=" rel="nofollow" class="external" title="Share this on LinkedIn">Share this on LinkedIn</a></li><li
class="shr-mail"> <a
href="http://www.shareaholic.com/api/share/?title=How%20to%20resize%20billions%20of%20images%20in%20the%20cloud&amp;link=http://www.nslms.com/2010/11/01/how-to-resize-billions-of-images-in-the-cloud/&amp;notes=As%20I%20was%20clearing%20out%20my%20RSS%20reader%20a%20few%20days%20back%2C%20I%20stopped%20to%20read%20a%20post%20on%20the%20Flickr%20dev%20blog%20about%20the%20%22new%22%20640px%20image%20size.%20%20In%20the%20article%20they%20lament%20that%20they%20wished%20they%20had%20made%20%22Large%22%20copies%20of%20all%20uploaded%20images%20because%20it%20would%20make%20generating%20the%20new%20640px%20size%20easier.%0D%0A%0D%0AThis%20&amp;short_link=&amp;shortener=google&amp;shortener_key=&amp;v=1&amp;apitype=1&amp;apikey=8afa39428933be41f8afdb8ea21a495c&amp;source=Shareaholic&amp;template=&amp;service=201&amp;tags=&amp;ctype=" rel="nofollow" class="external" title="Email this to a friend?">Email this to a friend?</a></li><li
class="shr-posterous"> <a
href="http://www.shareaholic.com/api/share/?title=How+to+resize+billions+of+images+in+the+cloud&amp;link=http://www.nslms.com/2010/11/01/how-to-resize-billions-of-images-in-the-cloud/&amp;notes=As%20I%20was%20clearing%20out%20my%20RSS%20reader%20a%20few%20days%20back%2C%20I%20stopped%20to%20read%20a%20post%20on%20the%20Flickr%20dev%20blog%20about%20the%20%22new%22%20640px%20image%20size.%20%20In%20the%20article%20they%20lament%20that%20they%20wished%20they%20had%20made%20%22Large%22%20copies%20of%20all%20uploaded%20images%20because%20it%20would%20make%20generating%20the%20new%20640px%20size%20easier.%0D%0A%0D%0AThis%20&amp;short_link=&amp;shortener=google&amp;shortener_key=&amp;v=1&amp;apitype=1&amp;apikey=8afa39428933be41f8afdb8ea21a495c&amp;source=Shareaholic&amp;template=&amp;service=210&amp;tags=&amp;ctype=" rel="nofollow" class="external" title="Post this to Posterous">Post this to Posterous</a></li><li
class="shr-twitter"> <a
href="http://www.shareaholic.com/api/share/?title=How+to+resize+billions+of+images+in+the+cloud&amp;link=http://www.nslms.com/2010/11/01/how-to-resize-billions-of-images-in-the-cloud/&amp;notes=As%20I%20was%20clearing%20out%20my%20RSS%20reader%20a%20few%20days%20back%2C%20I%20stopped%20to%20read%20a%20post%20on%20the%20Flickr%20dev%20blog%20about%20the%20%22new%22%20640px%20image%20size.%20%20In%20the%20article%20they%20lament%20that%20they%20wished%20they%20had%20made%20%22Large%22%20copies%20of%20all%20uploaded%20images%20because%20it%20would%20make%20generating%20the%20new%20640px%20size%20easier.%0D%0A%0D%0AThis%20&amp;short_link=&amp;shortener=google&amp;shortener_key=&amp;v=1&amp;apitype=1&amp;apikey=8afa39428933be41f8afdb8ea21a495c&amp;source=Shareaholic&amp;template=%2524%257Btitle%257D%2B-%2B%2524%257Bshort_link%257D&amp;service=7&amp;tags=&amp;ctype=" rel="nofollow" class="external" title="Tweet This!">Tweet This!</a></li><li
class="shr-digg"> <a
href="http://www.shareaholic.com/api/share/?title=How+to+resize+billions+of+images+in+the+cloud&amp;link=http://www.nslms.com/2010/11/01/how-to-resize-billions-of-images-in-the-cloud/&amp;notes=As%20I%20was%20clearing%20out%20my%20RSS%20reader%20a%20few%20days%20back%2C%20I%20stopped%20to%20read%20a%20post%20on%20the%20Flickr%20dev%20blog%20about%20the%20%22new%22%20640px%20image%20size.%20%20In%20the%20article%20they%20lament%20that%20they%20wished%20they%20had%20made%20%22Large%22%20copies%20of%20all%20uploaded%20images%20because%20it%20would%20make%20generating%20the%20new%20640px%20size%20easier.%0D%0A%0D%0AThis%20&amp;short_link=&amp;shortener=google&amp;shortener_key=&amp;v=1&amp;apitype=1&amp;apikey=8afa39428933be41f8afdb8ea21a495c&amp;source=Shareaholic&amp;template=&amp;service=3&amp;tags=&amp;ctype=" rel="nofollow" class="external" title="Digg this!">Digg this!</a></li><li
class="shr-friendfeed"> <a
href="http://www.shareaholic.com/api/share/?title=How+to+resize+billions+of+images+in+the+cloud&amp;link=http://www.nslms.com/2010/11/01/how-to-resize-billions-of-images-in-the-cloud/&amp;notes=As%20I%20was%20clearing%20out%20my%20RSS%20reader%20a%20few%20days%20back%2C%20I%20stopped%20to%20read%20a%20post%20on%20the%20Flickr%20dev%20blog%20about%20the%20%22new%22%20640px%20image%20size.%20%20In%20the%20article%20they%20lament%20that%20they%20wished%20they%20had%20made%20%22Large%22%20copies%20of%20all%20uploaded%20images%20because%20it%20would%20make%20generating%20the%20new%20640px%20size%20easier.%0D%0A%0D%0AThis%20&amp;short_link=&amp;shortener=google&amp;shortener_key=&amp;v=1&amp;apitype=1&amp;apikey=8afa39428933be41f8afdb8ea21a495c&amp;source=Shareaholic&amp;template=&amp;service=43&amp;tags=&amp;ctype=" rel="nofollow" class="external" title="Share this on FriendFeed">Share this on FriendFeed</a></li><li
class="shr-googlereader"> <a
href="http://www.shareaholic.com/api/share/?title=How+to+resize+billions+of+images+in+the+cloud&amp;link=http://www.nslms.com/2010/11/01/how-to-resize-billions-of-images-in-the-cloud/&amp;notes=As%20I%20was%20clearing%20out%20my%20RSS%20reader%20a%20few%20days%20back%2C%20I%20stopped%20to%20read%20a%20post%20on%20the%20Flickr%20dev%20blog%20about%20the%20%22new%22%20640px%20image%20size.%20%20In%20the%20article%20they%20lament%20that%20they%20wished%20they%20had%20made%20%22Large%22%20copies%20of%20all%20uploaded%20images%20because%20it%20would%20make%20generating%20the%20new%20640px%20size%20easier.%0D%0A%0D%0AThis%20&amp;short_link=&amp;shortener=google&amp;shortener_key=&amp;v=1&amp;apitype=1&amp;apikey=8afa39428933be41f8afdb8ea21a495c&amp;source=Shareaholic&amp;template=&amp;service=207&amp;tags=&amp;ctype=" rel="nofollow" class="external" title="Add this to Google Reader">Add this to Google Reader</a></li></ul><div
style="clear: both;"></div><div
class="shr-getshr" style="visibility:hidden;font-size:10px !important"><a
target="_blank" href="http://www.shareaholic.com/?src=pub">Get Shareaholic</a></div><div
style="clear: both;"></div></div> ]]></content:encoded> <wfw:commentRss>http://www.nslms.com/2010/11/01/how-to-resize-billions-of-images-in-the-cloud/feed/</wfw:commentRss> <slash:comments>0</slash:comments> </item> <item><title>Web development environment &#8211; &#8220;On The Go&#8221;</title><link>http://www.nslms.com/2009/04/07/web-development-environment-on-the-go/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=rss</link> <comments>http://www.nslms.com/2009/04/07/web-development-environment-on-the-go/#comments</comments> <pubDate>Tue, 07 Apr 2009 19:56:52 +0000</pubDate> <dc:creator>RyanG</dc:creator> <category><![CDATA[drupal]]></category> <category><![CDATA[php]]></category> <category><![CDATA[Software Development]]></category> <category><![CDATA[cygwin]]></category> <category><![CDATA[eclipse]]></category> <category><![CDATA[freeagent go]]></category> <category><![CDATA[linkedin]]></category> <category><![CDATA[portable]]></category> <category><![CDATA[seagate]]></category> <category><![CDATA[web development]]></category> <category><![CDATA[webdev]]></category> <category><![CDATA[xampp]]></category> <guid
isPermaLink="false">http://www.nslms.com/?p=70</guid> <description><![CDATA[Over the past few weeks I&#8217;ve been spending most of my spare time developing a couple of web sites.  These sites are based on the Drupal CMS written in PHP.  And I&#8217;ve taken a bit of a crash course in Drupal module design. When I set out developing these, I faced a challenge that I&#8217;d been aware [...]]]></description> <content:encoded><![CDATA[<div
class="tweetmeme_button" style="float: right; margin-left: 10px;"> <a
href="http://api.tweetmeme.com/share?url=http%3A%2F%2Fwww.nslms.com%2F2009%2F04%2F07%2Fweb-development-environment-on-the-go%2F"><br
/> <img
src="http://api.tweetmeme.com/imagebutton.gif?url=http%3A%2F%2Fwww.nslms.com%2F2009%2F04%2F07%2Fweb-development-environment-on-the-go%2F&amp;source=rjgeyer&amp;style=normal&amp;service=bit.ly&amp;b=2" height="61" width="50" /><br
/> </a></div><p>Over the past few weeks I&#8217;ve been spending most of my spare time developing a couple of web sites.  These sites are based on the Drupal CMS written in PHP.  And I&#8217;ve taken a bit of a crash course in Drupal module design.</p><p>When I set out developing these, I faced a challenge that I&#8217;d been aware of, but managed to avoid in the past.  How do I work on these projects in a predictable, constant environment, and still bring my code with me to work on my home machine, work machine, laptop, and anything else I happen to sit down in front of?</p><p>This blog post is about how I&#8217;ve accomplished this so far.  Read more after the break&#8230;</p><h2><span
id="more-70"></span>Portable Storage Device</h2><p>Your first inclination will probably be to install these tools on a USB thumb drive that you can easily store in your pocket.  And you&#8217;d be in good company, this was my first choice too.  However, after getting everything going, I quickly realized that it simply wasn&#8217;t fast enough.  Others have reported different results, and a lot has to do with the particular device, and the file system (NTFS is best).</p><p>That said, I chose to go a different route, with fewer unknowns, and picked up a <a
href="http://freeagent.seagate.com/en-us/hard-drive/portable-hard-drive/Free-Agent.html">Seagate FreeAgent Go 250GB USB harddrive</a>.  I picked it up with a docking port from our local Costco for $80 and it eliminates concerns I had about performance.</p><h2><a
name="File_Structure">File Structure</a></h2><p>Throughout the rest of this article, I&#8217;m going to refer to files in my file structure, so I may as well show it to you so that these references can make sense.  This probably isn&#8217;t the best layout, but it&#8217;s what works for me.</p><ul><li>FreeAgent Go Root<ul><li>ampp<ul><li>lampp</li><li>wampp</li><li>shared<ul><li>htdocs<ul><li>&lt;code&gt;</li></ul></li><li>mysql<ul><li>data<ul><li>&lt;databases&gt;</li></ul></li></ul></li></ul></li></ul></li><li>Portable<ul></ul></li><li>cygwin</li><li>libs<ul><li>java-runtime<ul><li>jre1.6.0_06</li></ul></li></ul></li><li>Program Files<ul></ul></li><li>7-ZipPortable</li><li>eclipse</li><li>FirefoxPortable</li><li>junction</li><li>Rapidsvn</li><li>soapui-2.5.1</li></ul></li></ul><h2>Foundation (AMPP)</h2><p>The first thing we&#8217;re going to needed is a good Apache, MySQL, PHP setup.  For this I did some quick googling and stumbled upon XAMPP.  This is an Apache Friends project that packages all the server side components I need.  You can check them out, and download it over at their <a
href="http://www.apachefriends.org/en/xampp.html">site</a>.</p><p>I just downloaded the zip file, and extracted it to my drive at \ampp\wampp.  If you don&#8217;t unzip this project to the root of your device, you&#8217;ll need to run the &#8220;setup_xampp.bat&#8221; batch script supplied.</p><h2>Shared Source &amp; Database Files</h2><p>For the sake of organization, and the ability to run this system on both Windows and Linux boxes (see notes below about linux), I&#8217;m keeping my htdocs and MySQL database files outside of the normal directory structure of the XAMPP installation.</p><p>See my <a
href="#File_Structure">File Structure</a> above..</p><p>This way all of the web files for my individual websites and projects go in the &#8220;htdocs&#8221; directory, while the database data files go in the &#8220;mysql\data&#8221; directory, making them easy to find.</p><p>Of course, this presents a problem since the XAMPP install won&#8217;t be looking in those directories for the databases and code.  So, to solve this I&#8217;ve written another small batch script which lives in the &#8220;shared&#8221; directory.  This script uses the microsoft system tool <a
href="http://technet.microsoft.com/en-us/sysinternals/bb896768.aspx">Junction.exe</a> to create links of my shared directories in the location that XAMPP is looking.  The junction.exe file is in an &#8220;Installers&#8221; directory on the drive, though I should probably move it somewhere more logical.  Here&#8217;s the script that deletes old junctions, and creates new ones.  You&#8217;ll want to run this when you move from computer to computer, since the drive letter of the USB drive will likely change, and the junctions are to absolute paths.  I put this file in \ampp\shared and it uses relative paths, so that&#8217;s important.</p><h4>refresh-junctions.bat</h4><p>[text toolbar="false"]for /d %%A in (htdocs\*) do &quot;..\..\Portable\Program Files\junction\junction.exe&quot; -d &quot;..\xampp\%%A&quot;<br
/> for /d %%A in (htdocs\*) do &quot;..\..\Portable\Program Files\junction\junction.exe&quot; -s &quot;..\xampp\%%A&quot; &quot;%%A&quot;</p><p>for /d %%A in (mysql\data\*) do &quot;..\..\Portable\Program Files\junction\junction.exe&quot; -d &quot;..\xampp\%%A&quot;<br
/> for /d %%A in (mysql\data\*) do &quot;..\..\Portable\Program Files\junction\junction.exe&quot; -s &quot;..\xampp\%%A&quot; &quot;%%A&quot;<br
/> [/text]</p><p>The requirement here of course is that you always create new sites by creating a directory in \ampp\shared\htdocs, and that any time you create a new database, you must move it&#8217;s directory from \ampp\wampp\mysql\data\&lt;database&gt; to \ampp\shared\mysql\data\&lt;database&gt; then re-run the refresh-junctions.bat script while the MySQL server is not running.  But it&#8217;s a fairly workable solution.</p><h2>Integrated Development Environment (IDE)</h2><p>Okay, so we&#8217;ve got a nice predictable, repeatable hosting environment.  Now to  write some code!</p><p>My personal choice of IDE is Eclipse with the PHP Development Tools (PDT).  Eclipse is by it&#8217;s nature portable since it&#8217;s a Java application, and the installation for the PDT is just to unzip it to a drive.  There are a couple of pitfalls though, and here&#8217;s what I&#8217;ve done to overcome them.</p><p>First, since Eclipse does require the Java runtime you have two choices.</p><ol><li>Make sure that a current JVM is installed on any machine you intend to run your portable environment on.</li><li>Carry a copy of the JVM with you!</li></ol><p>I chose #2, and used instructions found <a
href="http://www.jonlee.ca/how-to-run-eclipse-or-aptana-from-usb-drive/" target="_blank">here</a> to do it.  Basically, store a copy of the JVM on your disk and edit the Eclipse startup batch script to use your portable copy.  In my case, the JVM is in the Portable/libs/java-runtime directory as shown in my <a
href="#File_Structure">File Structure</a> above.</p><p>Secondly, I thought it would be a good idea to just store my workspace on the portable drive as well, so I could keep all my settings with me.  Thus far I haven&#8217;t found an elegant way to do this, since it apparently uses absolute paths for projects.  So instead I keep a workspace on each system I work on that has the settings.  I hope to find a better solution to this, and if I do I&#8217;ll post it here.</p><h2>Portable Firefox Browser &amp; Plugins</h2><p>Alright, so now we&#8217;ve got a web server to show our code, a nice IDE to write code in.  What we need is a predictable way to view it all.  You could install your favorite browser on every computer you interact with, or you could bring it with you!  In my case, Firefox is my very favorite browser so I used <a
href="http://portableapps.com/apps/internet/firefox_portable" target="_blank">Firefox Portable</a> so that I can take it and all my configuration preferences as well as Firefox Add-Ons with me.  My core set of Add-Ons which I find invaluable are..</p><ul><li><a
href="http://getfirebug.com/" target="_blank">Firebug</a></li><li><a
href="https://addons.mozilla.org/en-US/firefox/addon/35" target="_blank">IE View</a></li><li><a
href="https://addons.mozilla.org/en-US/firefox/addon/60" target="_blank">Web Developer</a></li></ul><h2>Portable *NIX tools with Cygwin</h2><p>So we&#8217;ve written some code in our portable IDE, we&#8217;ve tested it out using our portable web server and Firefox browser and we&#8217;re satisfied with the results, and want to upload them to our production server.  My very favorite method of doing so is over RSYNC so I transfer only what&#8217;s changed, and it&#8217;s secure.  In order to do that, I usually use cygwin.</p><p>On the surface it seems like it&#8217;d be easy to just install cygwin to a directory on your portable drive.  And in part, it is.  You can simply install to that directory, and you&#8217;re all set.  Problem is as soon as you move it to another computer, and that computer assigns your drive a different drive letter, everything breaks down real quick.  Some quick google searching revealed a way to make this work.  I had to make some minor tweaks in order to fit within my <a
href="#File_Structure">File Structure</a> but you can find the inspiration for my changes <a
href="http://www.dam.brown.edu/people/sezer/software/cygwin/" target="_blank">here</a>.</p><p>My changes are to the X.bat and uninstall.bat files.  I instead called them ~cygwin-install-X.bat and ~cygwin-uninstall.bat and put them in the cygwin install directory at Portable\cygwin.  Here they are.</p><h4>~cygwin-install-X.bat</h4><p>[text]for /F %%A in (&#8216;cd&#8217;) do set WD=%%A<br
/> bin\mount -m | bin\sed s/mount/&quot;%WD%\/bin\\/mount&quot;/ &gt; tmp\mount.log<br
/> bin\umount -c<br
/> bin\umount -A<br
/> bin\mount -bfu %WD%/ /<br
/> bin\mount -bfu %WD%/bin /usr/bin<br
/> bin\mount -bfu %WD%/lib /usr/lib</p><p>set path=%path%;%WD%\bin;%WD%\usr\X11R6\bin<br
/> start bin\rxvt.exe -title &quot;&quot; -bg &quot;#fafad2&quot; -fg &quot;#000040&quot; -color10 green4 -color14 brown -fn &quot;Lucida Console-14&quot; -geometry 80&#215;58+0+0 -sl 4000 -sr -tn rxvt -e /bin/bash &#8211;login -i<br
/> set DISPLAY=localhost:0.0<br
/> run usr\X11R6\bin\XWin -multiwindow -emulate3buttons 200<br
/> [/text]</p><h4>~cygwin-uninstall.bat</h4><p>[text]bin\umount -c<br
/> bin\umount -A<br
/> bin\bash  tmp\mount.log<br
/> bin\rm    tmp\mount.log<br
/> [/text]</p><h2>Portable Source Control (SVN)</h2><p>Lastly, you&#8217;ll probably want to submit your changes to some sort of source control.  In my case I&#8217;m using Concurrent Versioning (CVS) or Subversion (SVN) for my source control, and both are handled nicely by the portable version of <a
href="http://portableapps.com/node/13470" target="_blank">RapidSVN</a>.</p><p>So there you have it, my end to end solution for doing web development from a portable flash drive on any windows box you happen to come across.  My original intention was to be able to just plug this drive into any windows OR linux box and work, but I have some kinks to work out with the linux solution.  Watch this space for more on that as I develop it.</p><p>Hopefully this helps you if you&#8217;re trying to setup a nice portable webdev environment!</p><div
class="shr-bookmarks shr-bookmarks-center"><ul
class="socials"><li
class="shr-blogger"> <a
href="http://www.shareaholic.com/api/share/?title=Web+development+environment+-+%22On+The+Go%22&amp;link=http://www.nslms.com/2009/04/07/web-development-environment-on-the-go/&amp;notes=Over%20the%20past%20few%20weeks%20I%27ve%20been%20spending%20most%20of%20my%20spare%20time%20developing%20a%20couple%20of%20web%20sites.%C2%A0%20These%20sites%20are%20based%20on%20the%20Drupal%20CMS%20written%20in%20PHP.%C2%A0%20And%20I%27ve%20taken%20a%20bit%20of%20a%20crash%20course%20in%20Drupal%20module%20design.%0D%0A%0D%0AWhen%20I%C2%A0set%20out%20developing%20these%2C%20I%C2%A0faced%20a%20challenge%20that%20I%27d%20been%20aware&amp;short_link=&amp;shortener=google&amp;shortener_key=&amp;v=1&amp;apitype=1&amp;apikey=8afa39428933be41f8afdb8ea21a495c&amp;source=Shareaholic&amp;template=&amp;service=219&amp;tags=&amp;ctype=" rel="nofollow" class="external" title="Blog this on Blogger">Blog this on Blogger</a></li><li
class="shr-comfeed"> <a
href="http://www.nslms.com/2009/04/07/web-development-environment-on-the-go/feed" rel="nofollow" class="external" title="Subscribe to the comments for this post?">Subscribe to the comments for this post?</a></li><li
class="shr-facebook"> <a
href="http://www.shareaholic.com/api/share/?title=Web+development+environment+-+%22On+The+Go%22&amp;link=http://www.nslms.com/2009/04/07/web-development-environment-on-the-go/&amp;notes=Over%20the%20past%20few%20weeks%20I%27ve%20been%20spending%20most%20of%20my%20spare%20time%20developing%20a%20couple%20of%20web%20sites.%C2%A0%20These%20sites%20are%20based%20on%20the%20Drupal%20CMS%20written%20in%20PHP.%C2%A0%20And%20I%27ve%20taken%20a%20bit%20of%20a%20crash%20course%20in%20Drupal%20module%20design.%0D%0A%0D%0AWhen%20I%C2%A0set%20out%20developing%20these%2C%20I%C2%A0faced%20a%20challenge%20that%20I%27d%20been%20aware&amp;short_link=&amp;shortener=google&amp;shortener_key=&amp;v=1&amp;apitype=1&amp;apikey=8afa39428933be41f8afdb8ea21a495c&amp;source=Shareaholic&amp;template=&amp;service=5&amp;tags=&amp;ctype=" rel="nofollow" title="Share this on Facebook">Share this on Facebook</a></li><li
class="shr-linkedin"> <a
href="http://www.shareaholic.com/api/share/?title=Web+development+environment+-+%22On+The+Go%22&amp;link=http://www.nslms.com/2009/04/07/web-development-environment-on-the-go/&amp;notes=Over%20the%20past%20few%20weeks%20I%27ve%20been%20spending%20most%20of%20my%20spare%20time%20developing%20a%20couple%20of%20web%20sites.%C2%A0%20These%20sites%20are%20based%20on%20the%20Drupal%20CMS%20written%20in%20PHP.%C2%A0%20And%20I%27ve%20taken%20a%20bit%20of%20a%20crash%20course%20in%20Drupal%20module%20design.%0D%0A%0D%0AWhen%20I%C2%A0set%20out%20developing%20these%2C%20I%C2%A0faced%20a%20challenge%20that%20I%27d%20been%20aware&amp;short_link=&amp;shortener=google&amp;shortener_key=&amp;v=1&amp;apitype=1&amp;apikey=8afa39428933be41f8afdb8ea21a495c&amp;source=Shareaholic&amp;template=&amp;service=88&amp;tags=&amp;ctype=" rel="nofollow" class="external" title="Share this on LinkedIn">Share this on LinkedIn</a></li><li
class="shr-mail"> <a
href="http://www.shareaholic.com/api/share/?title=Web%20development%20environment%20-%20%22On%20The%20Go%22&amp;link=http://www.nslms.com/2009/04/07/web-development-environment-on-the-go/&amp;notes=Over%20the%20past%20few%20weeks%20I%27ve%20been%20spending%20most%20of%20my%20spare%20time%20developing%20a%20couple%20of%20web%20sites.%C2%A0%20These%20sites%20are%20based%20on%20the%20Drupal%20CMS%20written%20in%20PHP.%C2%A0%20And%20I%27ve%20taken%20a%20bit%20of%20a%20crash%20course%20in%20Drupal%20module%20design.%0D%0A%0D%0AWhen%20I%C2%A0set%20out%20developing%20these%2C%20I%C2%A0faced%20a%20challenge%20that%20I%27d%20been%20aware&amp;short_link=&amp;shortener=google&amp;shortener_key=&amp;v=1&amp;apitype=1&amp;apikey=8afa39428933be41f8afdb8ea21a495c&amp;source=Shareaholic&amp;template=&amp;service=201&amp;tags=&amp;ctype=" rel="nofollow" class="external" title="Email this to a friend?">Email this to a friend?</a></li><li
class="shr-posterous"> <a
href="http://www.shareaholic.com/api/share/?title=Web+development+environment+-+%22On+The+Go%22&amp;link=http://www.nslms.com/2009/04/07/web-development-environment-on-the-go/&amp;notes=Over%20the%20past%20few%20weeks%20I%27ve%20been%20spending%20most%20of%20my%20spare%20time%20developing%20a%20couple%20of%20web%20sites.%C2%A0%20These%20sites%20are%20based%20on%20the%20Drupal%20CMS%20written%20in%20PHP.%C2%A0%20And%20I%27ve%20taken%20a%20bit%20of%20a%20crash%20course%20in%20Drupal%20module%20design.%0D%0A%0D%0AWhen%20I%C2%A0set%20out%20developing%20these%2C%20I%C2%A0faced%20a%20challenge%20that%20I%27d%20been%20aware&amp;short_link=&amp;shortener=google&amp;shortener_key=&amp;v=1&amp;apitype=1&amp;apikey=8afa39428933be41f8afdb8ea21a495c&amp;source=Shareaholic&amp;template=&amp;service=210&amp;tags=&amp;ctype=" rel="nofollow" class="external" title="Post this to Posterous">Post this to Posterous</a></li><li
class="shr-twitter"> <a
href="http://www.shareaholic.com/api/share/?title=Web+development+environment+-+%22On+The+Go%22&amp;link=http://www.nslms.com/2009/04/07/web-development-environment-on-the-go/&amp;notes=Over%20the%20past%20few%20weeks%20I%27ve%20been%20spending%20most%20of%20my%20spare%20time%20developing%20a%20couple%20of%20web%20sites.%C2%A0%20These%20sites%20are%20based%20on%20the%20Drupal%20CMS%20written%20in%20PHP.%C2%A0%20And%20I%27ve%20taken%20a%20bit%20of%20a%20crash%20course%20in%20Drupal%20module%20design.%0D%0A%0D%0AWhen%20I%C2%A0set%20out%20developing%20these%2C%20I%C2%A0faced%20a%20challenge%20that%20I%27d%20been%20aware&amp;short_link=&amp;shortener=google&amp;shortener_key=&amp;v=1&amp;apitype=1&amp;apikey=8afa39428933be41f8afdb8ea21a495c&amp;source=Shareaholic&amp;template=%2524%257Btitle%257D%2B-%2B%2524%257Bshort_link%257D&amp;service=7&amp;tags=&amp;ctype=" rel="nofollow" class="external" title="Tweet This!">Tweet This!</a></li><li
class="shr-digg"> <a
href="http://www.shareaholic.com/api/share/?title=Web+development+environment+-+%22On+The+Go%22&amp;link=http://www.nslms.com/2009/04/07/web-development-environment-on-the-go/&amp;notes=Over%20the%20past%20few%20weeks%20I%27ve%20been%20spending%20most%20of%20my%20spare%20time%20developing%20a%20couple%20of%20web%20sites.%C2%A0%20These%20sites%20are%20based%20on%20the%20Drupal%20CMS%20written%20in%20PHP.%C2%A0%20And%20I%27ve%20taken%20a%20bit%20of%20a%20crash%20course%20in%20Drupal%20module%20design.%0D%0A%0D%0AWhen%20I%C2%A0set%20out%20developing%20these%2C%20I%C2%A0faced%20a%20challenge%20that%20I%27d%20been%20aware&amp;short_link=&amp;shortener=google&amp;shortener_key=&amp;v=1&amp;apitype=1&amp;apikey=8afa39428933be41f8afdb8ea21a495c&amp;source=Shareaholic&amp;template=&amp;service=3&amp;tags=&amp;ctype=" rel="nofollow" class="external" title="Digg this!">Digg this!</a></li><li
class="shr-friendfeed"> <a
href="http://www.shareaholic.com/api/share/?title=Web+development+environment+-+%22On+The+Go%22&amp;link=http://www.nslms.com/2009/04/07/web-development-environment-on-the-go/&amp;notes=Over%20the%20past%20few%20weeks%20I%27ve%20been%20spending%20most%20of%20my%20spare%20time%20developing%20a%20couple%20of%20web%20sites.%C2%A0%20These%20sites%20are%20based%20on%20the%20Drupal%20CMS%20written%20in%20PHP.%C2%A0%20And%20I%27ve%20taken%20a%20bit%20of%20a%20crash%20course%20in%20Drupal%20module%20design.%0D%0A%0D%0AWhen%20I%C2%A0set%20out%20developing%20these%2C%20I%C2%A0faced%20a%20challenge%20that%20I%27d%20been%20aware&amp;short_link=&amp;shortener=google&amp;shortener_key=&amp;v=1&amp;apitype=1&amp;apikey=8afa39428933be41f8afdb8ea21a495c&amp;source=Shareaholic&amp;template=&amp;service=43&amp;tags=&amp;ctype=" rel="nofollow" class="external" title="Share this on FriendFeed">Share this on FriendFeed</a></li><li
class="shr-googlereader"> <a
href="http://www.shareaholic.com/api/share/?title=Web+development+environment+-+%22On+The+Go%22&amp;link=http://www.nslms.com/2009/04/07/web-development-environment-on-the-go/&amp;notes=Over%20the%20past%20few%20weeks%20I%27ve%20been%20spending%20most%20of%20my%20spare%20time%20developing%20a%20couple%20of%20web%20sites.%C2%A0%20These%20sites%20are%20based%20on%20the%20Drupal%20CMS%20written%20in%20PHP.%C2%A0%20And%20I%27ve%20taken%20a%20bit%20of%20a%20crash%20course%20in%20Drupal%20module%20design.%0D%0A%0D%0AWhen%20I%C2%A0set%20out%20developing%20these%2C%20I%C2%A0faced%20a%20challenge%20that%20I%27d%20been%20aware&amp;short_link=&amp;shortener=google&amp;shortener_key=&amp;v=1&amp;apitype=1&amp;apikey=8afa39428933be41f8afdb8ea21a495c&amp;source=Shareaholic&amp;template=&amp;service=207&amp;tags=&amp;ctype=" rel="nofollow" class="external" title="Add this to Google Reader">Add this to Google Reader</a></li></ul><div
style="clear: both;"></div><div
class="shr-getshr" style="visibility:hidden;font-size:10px !important"><a
target="_blank" href="http://www.shareaholic.com/?src=pub">Get Shareaholic</a></div><div
style="clear: both;"></div></div> ]]></content:encoded> <wfw:commentRss>http://www.nslms.com/2009/04/07/web-development-environment-on-the-go/feed/</wfw:commentRss> <slash:comments>1</slash:comments> </item> <item><title>Drupal Flickr Module.  Now with URLs!</title><link>http://www.nslms.com/2009/03/27/drupal-flickr-module-now-with-urls/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=rss</link> <comments>http://www.nslms.com/2009/03/27/drupal-flickr-module-now-with-urls/#comments</comments> <pubDate>Fri, 27 Mar 2009 17:04:27 +0000</pubDate> <dc:creator>RyanG</dc:creator> <category><![CDATA[drupal]]></category> <category><![CDATA[php]]></category> <category><![CDATA[flickr]]></category> <category><![CDATA[flickr.urls.getUserPhotos]]></category> <category><![CDATA[linkedin]]></category> <category><![CDATA[urls]]></category> <guid
isPermaLink="false">http://www.nslms.com/?p=67</guid> <description><![CDATA[Okay, so I&#8217;ve been a bit preoccupied with a couple projects which have slowed my efforts at blogging etc. In both cases, I&#8217;ve been working on websites that leverage the PHP based Drupal CMS.&#160; One of those projects is over at http://www.chasejarvisshoeproject.com.&#160; That site is basically a small community forum for some folks that are [...]]]></description> <content:encoded><![CDATA[<div
class="tweetmeme_button" style="float: right; margin-left: 10px;"> <a
href="http://api.tweetmeme.com/share?url=http%3A%2F%2Fwww.nslms.com%2F2009%2F03%2F27%2Fdrupal-flickr-module-now-with-urls%2F"><br
/> <img
src="http://api.tweetmeme.com/imagebutton.gif?url=http%3A%2F%2Fwww.nslms.com%2F2009%2F03%2F27%2Fdrupal-flickr-module-now-with-urls%2F&amp;source=rjgeyer&amp;style=normal&amp;service=bit.ly&amp;b=2" height="61" width="50" /><br
/> </a></div><p>Okay, so I&#8217;ve been a bit preoccupied with a couple projects which have slowed my efforts at blogging etc.</p><p>In both cases, I&#8217;ve been working on websites that leverage the PHP based Drupal CMS.&nbsp; One of those projects is over at <a
href="http://www.chasejarvisshoeproject.com">http://www.chasejarvisshoeproject.com</a>.&nbsp; That site is basically a small community forum for some folks that are sending a pair of shoes around the world, and taking pictures of them in various locations and situations.&nbsp; Pretty cool.&nbsp; The result of this effort is a Flickr photo pool and a good time.</p><p>So, of course a website devoted to a group on Flickr, is going to require some integration with Flickr.&nbsp; Enter the <a
href="http://drupal.org/project/flickr">Drupal Flickr Module</a>.&nbsp; When I&nbsp;started using it, this module was still in either an alpha, or beta (can&#8217;t seem to remember) and has released it&#8217;s 1.0 as of the 25th of March.&nbsp; Throughout the time I&#8217;ve been using it however, there&#8217;ve been a few functions of the Flickr API which I&nbsp;needed, and the module didn&#8217;t support.&nbsp; Those were.</p><ul><li><a
href="http://flickr.com/services/api/flickr.groups.pools.getPhotos.html">flickr.groups.pools.getPhotos</a></li><li><a
href="http://flickr.com/services/api/flickr.urls.getGroup.html">flickr.urls.getGroup</a></li><li><a
href="http://flickr.com/services/api/flickr.urls.getUserPhotos.html">flickr.urls.getUserPhotos</a></li></ul><p>Since the framework of the module did the hard work of making the calls, it was easy to write my own methods which performed these Flickr API&nbsp;functions for me.&nbsp; And as the module developers released new versions, I&nbsp;just copy/pasted my code back into the new file, and went about my business.</p><p>Well when 1.0 was released, I&nbsp;took a closer look.&nbsp; It turns out they&#8217;d implemented the call to get photos from a group pool, but still nothing for the URL&#8217;s.&nbsp; So I&nbsp;figured I&#8217;d contribute and write a patch for the two calls I&nbsp;was still in need of.&nbsp; And that, is what you see here.</p><pre lang="diff">
569,597d568
< }
<
< /**
<  * @param $nsid
<  *   nsid of the group whose pool url will be returned
<  * @return
<  *   The URL portion of the response from the flickr method flickr.urls.getGroup
<  */
< function flickr_urls_get_group($nsid)
< {
<   $response = flickr_request('flickr.urls.getGroup', array('group_id' => $nsid));
< if($response)
<     return $response['group']['url'];
<
<   return FALSE;
< }
<
< /**
<  * @param $nsid
<  *   nsid of the user whose photostream url will be returned
<  * @return unknown_type
<  */
< function flickr_urls_get_user_photos($nsid)
< {
<   $response = flickr_request('flickr.urls.getUserPhotos', array('user_id' => $nsid));
< if($response)
<     return $response['user']['url'];
<
<   return FALSE;
</pre><p>As you can see, pretty basic but I&nbsp;figured I'd contribute.&nbsp; I&nbsp;posted this as a feature request/issue over on the Flickr Module's <a
href="http://drupal.org/node/414096">issue queue</a>, but have yet to receive a response.&nbsp; If nothing else, I&nbsp;can use this to patch the next version.&nbsp; Hopefully it helps someone else as well.</p> </pre><div
class="shr-bookmarks shr-bookmarks-center"><ul
class="socials"><li
class="shr-blogger"> <a
href="http://www.shareaholic.com/api/share/?title=Drupal+Flickr+Module.++Now+with+URLs%21&amp;link=http://www.nslms.com/2009/03/27/drupal-flickr-module-now-with-urls/&amp;notes=Okay%2C%20so%20I%27ve%20been%20a%20bit%20preoccupied%20with%20a%20couple%20projects%20which%20have%20slowed%20my%20efforts%20at%20blogging%20etc.%0D%0AIn%20both%20cases%2C%20I%27ve%20been%20working%20on%20websites%20that%20leverage%20the%20PHP%20based%20Drupal%20CMS.%26nbsp%3B%20One%20of%20those%20projects%20is%20over%20at%20http%3A%2F%2Fwww.chasejarvisshoeproject.com.%26nbsp%3B%20That%20site%20is%20basically%20a&amp;short_link=&amp;shortener=google&amp;shortener_key=&amp;v=1&amp;apitype=1&amp;apikey=8afa39428933be41f8afdb8ea21a495c&amp;source=Shareaholic&amp;template=&amp;service=219&amp;tags=&amp;ctype=" rel="nofollow" class="external" title="Blog this on Blogger">Blog this on Blogger</a></li><li
class="shr-comfeed"> <a
href="http://www.nslms.com/2009/03/27/drupal-flickr-module-now-with-urls/feed" rel="nofollow" class="external" title="Subscribe to the comments for this post?">Subscribe to the comments for this post?</a></li><li
class="shr-facebook"> <a
href="http://www.shareaholic.com/api/share/?title=Drupal+Flickr+Module.++Now+with+URLs%21&amp;link=http://www.nslms.com/2009/03/27/drupal-flickr-module-now-with-urls/&amp;notes=Okay%2C%20so%20I%27ve%20been%20a%20bit%20preoccupied%20with%20a%20couple%20projects%20which%20have%20slowed%20my%20efforts%20at%20blogging%20etc.%0D%0AIn%20both%20cases%2C%20I%27ve%20been%20working%20on%20websites%20that%20leverage%20the%20PHP%20based%20Drupal%20CMS.%26nbsp%3B%20One%20of%20those%20projects%20is%20over%20at%20http%3A%2F%2Fwww.chasejarvisshoeproject.com.%26nbsp%3B%20That%20site%20is%20basically%20a&amp;short_link=&amp;shortener=google&amp;shortener_key=&amp;v=1&amp;apitype=1&amp;apikey=8afa39428933be41f8afdb8ea21a495c&amp;source=Shareaholic&amp;template=&amp;service=5&amp;tags=&amp;ctype=" rel="nofollow" title="Share this on Facebook">Share this on Facebook</a></li><li
class="shr-linkedin"> <a
href="http://www.shareaholic.com/api/share/?title=Drupal+Flickr+Module.++Now+with+URLs%21&amp;link=http://www.nslms.com/2009/03/27/drupal-flickr-module-now-with-urls/&amp;notes=Okay%2C%20so%20I%27ve%20been%20a%20bit%20preoccupied%20with%20a%20couple%20projects%20which%20have%20slowed%20my%20efforts%20at%20blogging%20etc.%0D%0AIn%20both%20cases%2C%20I%27ve%20been%20working%20on%20websites%20that%20leverage%20the%20PHP%20based%20Drupal%20CMS.%26nbsp%3B%20One%20of%20those%20projects%20is%20over%20at%20http%3A%2F%2Fwww.chasejarvisshoeproject.com.%26nbsp%3B%20That%20site%20is%20basically%20a&amp;short_link=&amp;shortener=google&amp;shortener_key=&amp;v=1&amp;apitype=1&amp;apikey=8afa39428933be41f8afdb8ea21a495c&amp;source=Shareaholic&amp;template=&amp;service=88&amp;tags=&amp;ctype=" rel="nofollow" class="external" title="Share this on LinkedIn">Share this on LinkedIn</a></li><li
class="shr-mail"> <a
href="http://www.shareaholic.com/api/share/?title=Drupal%20Flickr%20Module.%20%20Now%20with%20URLs%21&amp;link=http://www.nslms.com/2009/03/27/drupal-flickr-module-now-with-urls/&amp;notes=Okay%2C%20so%20I%27ve%20been%20a%20bit%20preoccupied%20with%20a%20couple%20projects%20which%20have%20slowed%20my%20efforts%20at%20blogging%20etc.%0D%0AIn%20both%20cases%2C%20I%27ve%20been%20working%20on%20websites%20that%20leverage%20the%20PHP%20based%20Drupal%20CMS.%26nbsp%3B%20One%20of%20those%20projects%20is%20over%20at%20http%3A%2F%2Fwww.chasejarvisshoeproject.com.%26nbsp%3B%20That%20site%20is%20basically%20a&amp;short_link=&amp;shortener=google&amp;shortener_key=&amp;v=1&amp;apitype=1&amp;apikey=8afa39428933be41f8afdb8ea21a495c&amp;source=Shareaholic&amp;template=&amp;service=201&amp;tags=&amp;ctype=" rel="nofollow" class="external" title="Email this to a friend?">Email this to a friend?</a></li><li
class="shr-posterous"> <a
href="http://www.shareaholic.com/api/share/?title=Drupal+Flickr+Module.++Now+with+URLs%21&amp;link=http://www.nslms.com/2009/03/27/drupal-flickr-module-now-with-urls/&amp;notes=Okay%2C%20so%20I%27ve%20been%20a%20bit%20preoccupied%20with%20a%20couple%20projects%20which%20have%20slowed%20my%20efforts%20at%20blogging%20etc.%0D%0AIn%20both%20cases%2C%20I%27ve%20been%20working%20on%20websites%20that%20leverage%20the%20PHP%20based%20Drupal%20CMS.%26nbsp%3B%20One%20of%20those%20projects%20is%20over%20at%20http%3A%2F%2Fwww.chasejarvisshoeproject.com.%26nbsp%3B%20That%20site%20is%20basically%20a&amp;short_link=&amp;shortener=google&amp;shortener_key=&amp;v=1&amp;apitype=1&amp;apikey=8afa39428933be41f8afdb8ea21a495c&amp;source=Shareaholic&amp;template=&amp;service=210&amp;tags=&amp;ctype=" rel="nofollow" class="external" title="Post this to Posterous">Post this to Posterous</a></li><li
class="shr-twitter"> <a
href="http://www.shareaholic.com/api/share/?title=Drupal+Flickr+Module.++Now+with+URLs%21&amp;link=http://www.nslms.com/2009/03/27/drupal-flickr-module-now-with-urls/&amp;notes=Okay%2C%20so%20I%27ve%20been%20a%20bit%20preoccupied%20with%20a%20couple%20projects%20which%20have%20slowed%20my%20efforts%20at%20blogging%20etc.%0D%0AIn%20both%20cases%2C%20I%27ve%20been%20working%20on%20websites%20that%20leverage%20the%20PHP%20based%20Drupal%20CMS.%26nbsp%3B%20One%20of%20those%20projects%20is%20over%20at%20http%3A%2F%2Fwww.chasejarvisshoeproject.com.%26nbsp%3B%20That%20site%20is%20basically%20a&amp;short_link=&amp;shortener=google&amp;shortener_key=&amp;v=1&amp;apitype=1&amp;apikey=8afa39428933be41f8afdb8ea21a495c&amp;source=Shareaholic&amp;template=%2524%257Btitle%257D%2B-%2B%2524%257Bshort_link%257D&amp;service=7&amp;tags=&amp;ctype=" rel="nofollow" class="external" title="Tweet This!">Tweet This!</a></li><li
class="shr-digg"> <a
href="http://www.shareaholic.com/api/share/?title=Drupal+Flickr+Module.++Now+with+URLs%21&amp;link=http://www.nslms.com/2009/03/27/drupal-flickr-module-now-with-urls/&amp;notes=Okay%2C%20so%20I%27ve%20been%20a%20bit%20preoccupied%20with%20a%20couple%20projects%20which%20have%20slowed%20my%20efforts%20at%20blogging%20etc.%0D%0AIn%20both%20cases%2C%20I%27ve%20been%20working%20on%20websites%20that%20leverage%20the%20PHP%20based%20Drupal%20CMS.%26nbsp%3B%20One%20of%20those%20projects%20is%20over%20at%20http%3A%2F%2Fwww.chasejarvisshoeproject.com.%26nbsp%3B%20That%20site%20is%20basically%20a&amp;short_link=&amp;shortener=google&amp;shortener_key=&amp;v=1&amp;apitype=1&amp;apikey=8afa39428933be41f8afdb8ea21a495c&amp;source=Shareaholic&amp;template=&amp;service=3&amp;tags=&amp;ctype=" rel="nofollow" class="external" title="Digg this!">Digg this!</a></li><li
class="shr-friendfeed"> <a
href="http://www.shareaholic.com/api/share/?title=Drupal+Flickr+Module.++Now+with+URLs%21&amp;link=http://www.nslms.com/2009/03/27/drupal-flickr-module-now-with-urls/&amp;notes=Okay%2C%20so%20I%27ve%20been%20a%20bit%20preoccupied%20with%20a%20couple%20projects%20which%20have%20slowed%20my%20efforts%20at%20blogging%20etc.%0D%0AIn%20both%20cases%2C%20I%27ve%20been%20working%20on%20websites%20that%20leverage%20the%20PHP%20based%20Drupal%20CMS.%26nbsp%3B%20One%20of%20those%20projects%20is%20over%20at%20http%3A%2F%2Fwww.chasejarvisshoeproject.com.%26nbsp%3B%20That%20site%20is%20basically%20a&amp;short_link=&amp;shortener=google&amp;shortener_key=&amp;v=1&amp;apitype=1&amp;apikey=8afa39428933be41f8afdb8ea21a495c&amp;source=Shareaholic&amp;template=&amp;service=43&amp;tags=&amp;ctype=" rel="nofollow" class="external" title="Share this on FriendFeed">Share this on FriendFeed</a></li><li
class="shr-googlereader"> <a
href="http://www.shareaholic.com/api/share/?title=Drupal+Flickr+Module.++Now+with+URLs%21&amp;link=http://www.nslms.com/2009/03/27/drupal-flickr-module-now-with-urls/&amp;notes=Okay%2C%20so%20I%27ve%20been%20a%20bit%20preoccupied%20with%20a%20couple%20projects%20which%20have%20slowed%20my%20efforts%20at%20blogging%20etc.%0D%0AIn%20both%20cases%2C%20I%27ve%20been%20working%20on%20websites%20that%20leverage%20the%20PHP%20based%20Drupal%20CMS.%26nbsp%3B%20One%20of%20those%20projects%20is%20over%20at%20http%3A%2F%2Fwww.chasejarvisshoeproject.com.%26nbsp%3B%20That%20site%20is%20basically%20a&amp;short_link=&amp;shortener=google&amp;shortener_key=&amp;v=1&amp;apitype=1&amp;apikey=8afa39428933be41f8afdb8ea21a495c&amp;source=Shareaholic&amp;template=&amp;service=207&amp;tags=&amp;ctype=" rel="nofollow" class="external" title="Add this to Google Reader">Add this to Google Reader</a></li></ul><div
style="clear: both;"></div><div
class="shr-getshr" style="visibility:hidden;font-size:10px !important"><a
target="_blank" href="http://www.shareaholic.com/?src=pub">Get Shareaholic</a></div><div
style="clear: both;"></div></div> ]]></content:encoded> <wfw:commentRss>http://www.nslms.com/2009/03/27/drupal-flickr-module-now-with-urls/feed/</wfw:commentRss> <slash:comments>0</slash:comments> </item> </channel> </rss>
