In your loop write the img, and a <div> with the other information in it.
Set the div to be hidden using CSS, then use a javascript onclick event handler to show that div when the img is clicked upon.
ie:
<?php
echo '<ul id="people">';
foreach($people as $p)
{
echo '<li id="person_'.$p['id'].'" class="person cool">';
echo '<img src="'.base_url().'images/photos/'.$p['photo_small'].'" title="'.$p['first_name'].' '.$p['last_name'].'" onclick="warmItem(\'people\',\'person\',\'person_'.$p['id'].'\');" />';
echo '<div id="" class="hidden">'.$p['extra info'].'</div>';
echo '</li>';
}
?>
CSS:
li.cool div { display:none;}
li.warm div { display:block; }
JS
function warmItem(id,force) {
if(!document.getElementById) { return; }
obj = document.getElementById(id);
if(obj) {
if(force) {
if(obj.className.match("cool")) { obj.className = obj.className.replace(/cool/, ""); }
if(obj.className.match("warm")) { obj.className = obj.className.replace(/warm/,""); }
obj.className = obj.className + " " + force;
}
else {
if(obj.className.match("cool")) { obj.className = obj.className.replace(/cool/, "warm"); }
else if (obj.className.match("warm")) { obj.className = obj.className.replace(/warm/,"cool"); }
else {obj.className = obj.className + " warm"; }
}
}
}
function warmItems(parent,cl,warm) {
if(!document.getElementById) { return; }
p = document.getElementById(parent);
nodes = p.childNodes;
for(i=0;i<nodes.length;i++){
var node = nodes[i];
if(node.className && node.className.match(cl)) { warmItem(node.id,'cool'); }
}
warmItem(warm,'warm');
}