Visualizing 4.5 years of Flickr development

We were impressed with Michael Ogawa’s code_swarm project, so were understandably excited when he made the source available (under the GPL v3). We sprang into action, avoiding the real work we were supposed to be doing and created some visualizations of the main Flickr subversion repository.

In this visualization, blue represents PHP, green is HTML, red is Java, purple is CSS and JavaScript, Cyan is Flash and ActionScript, with yellow filling in for everything else.

Myles took it a step further, using the tool to visualize our internal bug tracking system. In this movie, each node represents an issue, flashing red as it was opened, orange as it was assigned, blue as we argued about what to do and final green when it was resolved.

This required a little modification of the software to allow for states on nodes, so that the node color can change as the state changes. Myles has also been working on some modifications to improve upon the abrupt endings. New movies might get posted here if they’re awesome enough.

We’re hard at work (well, sort-of-work) thinking up new things to visualize and new ways to present the data. If you have some bright ideas, why not post them in the code forum.

Trickr, or Humanising the Developers (Part 1)

We busy little nerds of Flickr may act and smell like a bunch of psychotic monkey-bots, but beneath our filth-drenched metal exteriors beat the fleshy hearts of a thousand delicate human flowers. We feel, we love.

Ever wondered what keeps us well-oiled? I did, so I asked people, “What do you use to get the job done?”

And this, my dubious friends, is how we (rick)roll.

[flickr_staff_buddy_icon name=straup]
Aaron, Ce sera mauvais français parce que j’ai utilisé l’Internet
You’re still wrong

  • Emacs (dired-mode and shell-mode and M-x goto-line)
  • Glimpse (and alias grep grep -n -r -e)
  • Tabs and virtual workspaces

[flickr_staff_buddy_icon name=bees]
Cal, Baconmeister
Fuck off and die

  • shitty pc laptop w/ xp pro
  • twin 20″ monitors
  • noted
  • explorer
  • ff & thunderbird
  • putty / pageant / plink
  • winscp
  • cygwin
  • msys & mingw
  • wireshark
  • paint shop pro 5
  • miranda
  • calc & chamap
  • tortoise cvs/svn
  • beyond compare
  • apache/mysql/php
  • ms office w/ visio
  • itunes

[flickr_staff_buddy_icon name=revdancatt]
Dan, The Rev.
I don’t do quotes

2 Machine setup;

MacBook Pro for writing code, TextWrangler (off-white Lucida Grande 11pt font on blue background, for reduced eye-strain), Safari & Opera for (final) testing.

PC for testing, with IE6,7,blah + MS Script debugger. Most testing takes place in Firefox + Firebug (cannot live without firebug). Monitor rotated 90 degrees to give Firebug more real estate for hacking around the dom, editing js script on the fly, etc.

Extras:

[flickr_staff_buddy_icon name=dunstan]
Dunstan, He’s like, got a dog and stuff
Mistakenly included on the engineering mailing list for 505 days and counting

  • Macbook Pro
  • Textmate
  • Photoshop
  • Transmit
  • Safari
  • Firefox+Firebug
  • IE (in Parallels)
  • Quicksilver

[flickr_staff_buddy_icon name=eric]
Eric, Teenage Mutant Ninja Scripta
Please, just work

Powerbook, BBEdit, Perl scripts to manage scp+cvs+Flex+compression, Firefox w/ Firebug and Webdev toolbar, Flex 3 SDK, Terminal, nano, Parallels.

[flickr_staff_buddy_icon name=kellan]
Kellan, Rebellious off-worlder
I’d rather be building cloud castles

MBP, a hot-rodded version of Textmate, QuickSilver+Terminal.app (what’s the Finder?), Thunderbird + keyconfig for threading and archiving, SSHKeychain, grep, awk, tree, QuickProxy for Firefox (2.x), WordPress.com, last.fm, Pandora, and Adium. used to use PHPfi, but less lately.

[flickr_staff_buddy_icon name=murphy_slaw]
Murphy, Secret ops mole
… –force –yes –quiet > /dev/null 2>&1

  • MacBook Pro
  • iTerm
  • vim, kill, screen, awk, rsync, mtr, nmap, strace, gdb
  • Wireshark
  • SSH Agent
  • Thunderbird + Enigmail
  • Firefox + Firebug + SwitchProxy + Nagios Checker
  • Adium
  • Caffeine
  • Home Zone

Coming soon: more responses!

Flickr at XTech (and slides from SXSW…)

Once upon a time, webheads used to talk about “conference season”, but it seems that these days there’s always a conference running somewhere. Having dispensed with Web 2.0, we’re now turning our attention to XTech 2008, which takes place in Dublin, Ireland from Tuesday May 6th to Friday May 9th.

The Flickr team has two talks lined up for those attending XTech. Through a freak scheduling accident they’re back-to-back, giving attendees the exciting opportunity to experience one and a half straight hours of pure Flickr-related goodness:

Hopefully we’ll see some of you there!

Looking backwards for a moment, this is also a chance to re-post the slides from my previous internationalization-themed talk, “Taking Over the World, The Flickr Way” which I gave at South by Southwest in March. This hour-long session was a high-level overview of some of the challenges and solutions we stumbled upon during the internationalization and localization of Flickr.com which we undertook in the first half of 2007:

Versions of the slides in other formats (keynote, swf, pdf) are available here.

As for Web 2.0 Expo, some of the team’s presentations should be showing up here in the next week or so, starting with slides from the delectable John Allspaw.

Videos in the Flickr API

It isn’t just you, the pictures really did start moving, some of them at least. Which is an attempt at humor to cover the fact that this post is very belated.

Presumably you’ve noticed that folks are uploading videos to Flickr, and you’re wondering how to work with video in the API? I’ll try to recap, and expand upon the info in this thread in the API group.

Long Photos

First thing to understand is as far as Flickr is concerned videos are just a funny type of photo. Your API application can ignore that video exists and everything should go on working. This means:

  • you can display a preview of a video by treating it exactly like any other photo on Flickr.
  • photos AND videos are returned by any method which used to return just photos
  • you can get info about a video like you would a photo.

Videos, photos, and “media”

If you’re calling one of the dozens of API methods including flickr.photos.search() and … that return what we call a “standard photo response” then that API method takes an “extras” argument. extras is a comma separated list of additional metadata you would like included in the API response.

With the launch of video we’ve added a new extra: “media”. Included media in your list of requested extras and we’ll include a new attribute media=photo or media=video with each photo element. Like so:

<photo id="2345938910" owner="35468159852@N01" secret="846d9c1be9" server="1423" farm="2" title="Naughty Dandelion" ispublic="1" isfriend="0" isfamily="0" media="video"/>

Additionally if you’re calling flickr.photos.search() you can filter your results by media type by passing `media=photos` or `media=videos` as an additional search argument. (not to be confused with the extras of the same name)

Default is “media=both” returning both photos and videos.

Displaying videos: just funny photos

For each uploaded video we generate a JPG preview in a range of sizes. Identical to what we do for photos.

Read the documentation for flickr.photos.getSizes() to get you started on how to display Flickr photos.

Playing videos: constructing the embed code

We don’t currently provide a way to get to the FLV for a video. (the Flash encoded video file) We’re looking into making this possible. In the mean time if you want to display watch-able videos you’ll need to embed our video player.

In addition to the photo height and width of the preview images, videos also have a stream height and stream width which we set when we process videos during upload. While you can make the video player any size you want the videos are going to look much better if displayed at the proper size.

You can get the stream height and stream width and the URL for the video player using the standard flickr.photos.getSizes() method:

<sizes canblog="1" canprint="1" candownload="1">
<size label="Square" width="75" height="75" source="http://farm2.static.flickr.com/1423/2345938910_846d9c1be9_s.jpg" url="http://www.flickr.com/photos/revdancatt/2345938910/sizes/sq/" media="photo"/>
... standard getSizes stuff ...
<size label="Video Player" width="500" height="375" source="http://www.flickr.com/apps/video/stewart.swf?v=49235&photo_id=2345938910&photo_secret=846d9c1be9" url="http://www.flickr.com/photos/revdancatt/2345938910/" media="video"/>
</sizes>

Alternately the stream width and height are included in the new video element returned by flickr.photos.getInfo()
:

...
<video ready="1" failed="0" pending="0" duration="14" width="500" height="375" />
</photo>
....

Generating Embed Code

The player takes a height, a width, a photo id, a photo secret (required for playing non-public videos), and the argument flickr_show_info_box, which when set to layers over top of the video videographer, and video title info when the video isn’t playing.

I’m not going to go over in depth the markup for the player, but here is a quick and dirty PHP function for generating it:

#
# takes a "Video Player" source from flickr.photos.getSizes() and optional display arguments
#

function flickr_video_embed($video_url, $width="400", $height="300", $info_box="true") {

    $markup = <<<EOD
<object type="application/x-shockwave-flash" width="$width" height="$height" data="$video_url"  classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"> <param name="flashvars" value="flickr_show_info_box=$info_box"></param> <param name="movie" value="$video_url"></param><param name="bgcolor" value="#000000"></param><param name="allowFullScreen" value="true"></param><embed type="application/x-shockwave-flash" src="$video_url" bgcolor="#000000" allowfullscreen="true" flashvars="flickr_show_info_box=$info_box" height="$height" width="$width"></embed></object>
EOD;
    return $markup;

}

Videos in the feeds

Videos, unsurprisingly, are included in all of the various RSS and Atom feeds which contain photos. For each video entry we include a MediaRSS content element that points to the SWF player, and has a content type of “application/x-shockwave-flash”. Additional we include the stream height and width as the height and width elements in the content element.

In RSS 2.0 feed we also include an enclosure element.

Uploading Videos

Upload videos just like you would a photo. We’ll do the magic to figure out whether the uploaded file is a video or a photo. You’ll generally want to use the asynchronous upload methods as videos tend to be larger, and take more time to upload.

Videos need to be “transcoded” — turned into an FLV which is playable on the Web. As this takes time videos aren’t always immediately available for viewing. You can check the processing status of a video using flickr.photos.getInfo(), and examining the video element.

<video ready="1" failed="0" pending="0" duration="14" width="0" height="0"/>

ready is watchable, pending is still being transcoded, and failed videos need to be re-uploaded. (possibly in a different format)

More Questions?

We’ve got an open thread in the Flickr API group discussing video.

Twitter API updates, FireEagle and new Flickr API fun

Last night twitter released their next batch of API improvements, of course the one that caught my eye was …

“[NEW] /account/update_location.[xml|json] – sets the location for the
authenticated user to the string passed in a “location” parameter.
Nothing fancy, no geocoding or normalization. Just putting this out
there so developers can start playing with how geolocation might fit
into their Twitter applications.”

saving woeids in the location field

… which is nice as it’s just thrown in there as a ‘what if’ type of thing. There’s no direct reason for twitter to have location stuff, (well no more than Flickr I guess) but everyone knows that everyone wants it.

It’d be great if you didn’t have to update twitter yourself and there was something else out there that could do it for us.

Read the rest of “Twitter API updates, FireEagle and new Flickr API fun” for more on Twitter’s location API, FireEagle, and Flickr’s not-a-geocoder.

FireDopplGängEaglr

First, there was filtr but that’s another story entirely. The point being that I gave up carrying around a capital-C camera a few years ago choosing instead to make do with cameraphones and the availability of cheap, unlimited data-plans in the U.S.

I am mostly lazy and can’t really be bothered to shuttle photos around from one device to another only to move them again to the giant device in the sky called Flickr. Before filtr I relied on the upload by email feature to snag a photo and quickly share it with the future-past but the desire to touch up — or filter — the photos before upload meant that I needed to write my own service to accept, process and then upload pictures to Flickr using the API.

ph:camera=n82

Which is what I want to talk about. Sort of.

Read the rest of “FireDopplGängEaglr” for thoughts on FireEagle, Dopplr, place, and the DWIM engine.

Inside Photophlow: an interview with Neil Berkman

photophlow

I knew when we started talking about Code.Flickr I wanted to have interviews with third party developers, and I knew that I wanted my first interview to be with Neil Berkman, one of the engineers behind the amazing Photophlow

1. Can you say a bit about what Photophlow is for people who don’t know?

Photophlow is a web application for real-time group Flickr browsing. As you search and share photos the group you’re browsing with sees the same things you are instantly. You can comment on photos, fave them, tag them and more, and all of this is shared with the group in real-time. Photophlow is meant to be used for all types of interactions around photos – organized activities such as group critiques and tutorials, as well as just plain hanging out and sharing.

We also integrate with some other services like Twitter and Tumblr. For example you can send out a Twitter message with a link to your Photophlow room to invite your followers to a real-time conversation over photos. We also integrate with the major IM networks to notify you instantly when things happen in Photophlow, like someone commenting on one of your photos.

If you’d like to a quick tour of Photophlow I’d recommend this screencast.

(editor note: Also checkout the photophlow group!)

2. How are you integrating with Flickr? What services or API methods do you use?

We use quite a bit of the API. Your identity on Photophlow is your Flickr identity, so of course we take advantage of authentication. We currently have two types of rooms – “personal rooms” tied to a user and rooms based on Flickr groups. We use the contacts and groups API’s to give control over privacy.

We take advantage of almost all of the API methods for browsing or searching for photos. And of course tagging, commenting and faving all go through the API.

One of my favorite features makes use of machine tags. We let you specify custom “photo emotes” – for example if you type /smile as a chat message we’ll show a photo you’ve tagged as phlow:emote=smile. Another makes use of the Yahoo Term Extraction API. We use this to determine interesting words and phrases in chat messages and we turn these into Flickr search links. Keying off of the conversation like this works really nicely for discovering areas of Flickrspace that you might not discover otherwise, and the results you get from clicking on a random phrase are often very funny and unexpected.

3. What if you favorite part of working with the Flickr APIs?

The nicest thing about it is the completeness. So far we’ve found that almost everything we’ve wanted to do has been possible.

4. What (if any) where the challenges?

The major challenges we face are due to the unique real-time group nature of our application. We’d like to be responsible consumers of the API so we set some restrictions for ourselves, such as never making a separate API call for each person in the room. For example when we display a photo we don’t indicate whether it’s already a fave because we’d need to make this call multiple times. We turned this into a feature – if you “re-fave” a photo we delete your previous fave and add it again, moving it to the top of your list.

5. What else should I have asked you? (I’m new at this!)

How about “what would you like to see added to the API?”

One is “invite photo to group”. Some group admins are using Photophlow to review photos to invite to their pool. It would be great if we could allow them to actually issue the invitations from within Photophlow.

Another, much larger one would be the ability to invite your Flickr contacts to use a Flickr-based application. This would take a lot of work to ensure that it could be done in a non-spammy way. Even I have mixed feelings about it but as an app developer it would be nice to allow people to use their existing connections on Flickr to be able spread the word about an application more easily.

6. Are you using any open source components in Photophlow, especially any that relate to Flickr? Are you planning to release any?

Like everybody these days we make heavy use of open source. The part of Photophlow that interacts with Flickr is developed using Ruby on Rails, and we use the Ruby API for Flickr. We’ve hacked this up a bit and may either clean it up and contribute back or take another look at the current Ruby Flickr interfaces and see if we might want to switch.

7. What is next? Are you planning to build more with Flickr? Enhance your current app, or build something new? Is there an application you’re hoping someone else would build?

We plan on improving Photophlow in a number of ways. A big one is to provide more explicit support for events such as critiques and competitions. There are a number of fun features we’d love to build, for example the ability to add notes to photos and share these in real-time.

We’re also building a new web application called Videophlow, which allows for group synchronous video viewing with a “shared remote control”. Initially this will support Youtube but we’re planning to support other services and would love to include Flickr video as well.

Thanks so much Neil and good luck at Launchpad today!

Have you got a neat Flickr project folks should know about? Let us know in recommendations for the DevBlog thread!

Photo: “photophlow” by d.j. paine

Making a better Flickr Web Uploadr (Or, “Web Browsers Aren’t Good At Uploading Files By Themselves”)

Sometimes when browsers won’t do what you want by themselves, you have to get creative.

A Brief History Of Web Uploading

As any developer who’s suffered through form-based uploading will understand, browsers have very limited native support for selecting and uploading files. While useable, Flickr’s form-based upload needed a refresh that would allow for batch selection and other improvements. After some consideration, Flash’s file-handling capabilities combined with the usual HTML/CSS/JS looked to be the winning solution.

In the past, ActiveX controls and Firefox extensions provided enhanced web-based upload experiences on Yahoo! Photos, supporting batch uploads, per-file progress , error reporting and so on; however, the initial browser-specific download/install requirement was “just another thing in the way” of a successful experience, not to mention one limited to Firefox and Internet Explorer. With Flickr’s new web Uploadr, my personal goals were to minimize or eliminate an install/set-up process altogether whenever possible, while at the same time keeping the approach browser-agnostic. Because of Flash’s distribution amongst Flickr users, it was safe to have as a requirement for the new experience. (In the non-flash/unsupported cases, browsers fall through to the old form-based Uploadr.)

And Now, For Something Completely Different

By using Flash to push files to Flickr, a number of advantages were clear over the old form-based method:

  • Batch file selection
  • File details (size, date etc.) for UI, business logic
  • Improved upload speed (faster than native browser form-based upload)
  • “Per-file”, asynchronous upload (as opposed to posting all data at once)
  • Upload progress reporting (per-file and overall)

Flash is able to do batch selection through standard operating system dialogs, report file names and size information, POST file data and read responses. Flickr’s new web Uploadr uses these features to provide a much-needed improvement over the old form-based Uploadr. The Flash component was developed by Allen Rabinovich on the Yahoo! Flash Platform Team. http://developer.yahoo.com/flash/

This Flash-based upload method did come with a few technical quirks, but ultimately we were still able to make signed calls to the Flickr API and upload files.

Now You Can, Too!

The Flash and client-side code which underlies the Flickr Web Uploadr is part of the Yahoo User Interface Library, available as the YUI Uploadr component.

It’s The Little Things That Count: UI Feedback

Given that Flash reports both file size and bytes uploaded, it made sense to show progress in the UI. In addition to per-file and overall progress in-page, the page’s title as shown in a browser window or tab also updates to reflect overall progress during upload – for example, “(42% complete) Flickr: Upload Photos”

Under Firefox, an .GIF-based “favicon” replaces the static Flickr icon, showing animation in the browser address bar while uploading is active. This combined with the title change is a nice indication of activity and status while the page is “working”, a handy way of checking progress without requiring the user to work to bring the window or tab back into focus.

In showing attention to detail in the UI and finding creative solutions to common browser drawbacks, a much nicer web upload experience is most certainly possible.

Scott Schiller is a front-end engineer and self-professed “DHTML + web standards evangelist / resident DJ and record crate digger” who works on Flickr. He enjoys making browsers do nifty things with client-side code, and making designers happy in bringing their work to life with close attention to detail. His personal site is a collection of random client-side experiments. http://flickr.com/photos/schill/