Obama Countdown Widget
February 9th, 2010
New Obama Countdown Widget now Live!
I have worked on a Zend Framework these past couple of days and needed the ability to display a users avatar. This is easy by using Automattic’s gravatar project. The easiest way to add a users avatar is to use a (this) view helper. Basically in your view you just pass the user’s email address and a desired size and your all set. Make sure in the view helper you specify the default image if the user doesn’t have an avatar to display.
You can download the source here. Comments and improvements are always welcome.
<?php
/**
*
* @author Shaun Farrell
* @version 1.0
*/
require_once 'Zend/View/Interface.php';
/**
* Gravatar helper
*
* @uses viewHelper Zend_View_Helper
*/
class Zend_View_Helper_Gravatar {
/**
* @var Zend_View_Interface
*/
public $view;
/**
*
* @var unknown_type
*/
protected $_gravatarUrl = "http://www.gravatar.com/avatar.php?";
/**
*
* @var unknown_type
*/
protected $_defaultImage = "http://everquest.allakhazam.com/pgfx/item_576.png";
/**
*
* @param $emailAddress
* @param $size
* @param $imgAlt
*/
public function gravatar($emailAddress, $size = "40", $imgAlt = "")
{
$gravatarId = "gravatar_id=" . md5(strtolower(trim($emailAddress)));
$url = $this->_gravatarUrl . $gravatarId . "&default=" . urlencode($this->_defaultImage) .
"&size=" . $size;
echo "<img src=\"$url\" alt=\"$imgAlt\" />";
return null;
}
/**
* Sets the view field
* @param $view Zend_View_Interface
*/
public function setView(Zend_View_Interface $view) {
$this->view = $view;
}
}
Yesterday I had the great opportunity to here Raphael Mudge the creator of AtD present After the Deadline at DC PHP. Below is a recording of the talk. I hope to write some more about AtD after I play around with it more.
Every Sunday morning I like to watch the CBS “Sunday Morning” Show. It’s more relaxing news that makes you feel good especially on a Sunday Morning. They have some really good segments that they do and it looks really good in HD. Oh yea, and who can forget the awesome bow-ties worn by Charles Osgood.
Well this Sunday they did a segment on Reveling in ‘America’s Best Idea’, Filmmaker Ken Burns Talks About His Latest Documentary, a History of Our National Parks. It was a great segment however, one lower third caught our eye.
Anyone see it? Look at the map. Wyoming is on top of Montana! It should be the other way around! Pretty crazy that no one caught that including the producer!
It should look like this.
