10675) {
$iustart = strpos ($xml, "http://b");
$host = "akamai";
}
$iuend = strpos ($xml, "\"", $iustart);
$imageurl = substr ($xml, $iustart, ($iuend - $iustart));
*/
//// NEW FOR 7.0
// If at this point $xml is empty, they have Profile 2.0. Let's do this.
if (strlen ($xml) === 0) {
$iurlprepre = strpos ($xml2, "alt=\"Photo of");
$iurlpre = (strpos ($xml2, "src=\"", $iurlprepre) + 5);
$xml2 = substr ($xml2, $iurlpre);
$iurlend = strpos ($xml2, "\" />");
$xml2 = substr ($xml2, 0, $iurlend);
// Now get $xml back to the way it should be. :)
$xml = $xml2;
}
$imageurl = $xml;
if (substr ($imageurl, -3, 3) == "jpg") {
$itype = "jpeg";
} elseif (substr ($imageurl, -3, 3) == "gif") {
$itype = "gif";
} elseif (substr ($imageurl, -3, 3) == "png") {
$itype = "png";
}
// Just about all the pictures have migrated over to the Akamai system now, but some of them still have the
// old LLNW naming scheme. Here's the override just in case:
$iupresplit = explode ("/", $imageurl);
foreach ($iupresplit as $iupart) {
$imfn = $iupart;
}
if (substr ($imfn, 1, 1) == "_") {
$host = "akamai";
}
if (substr ($imfn, -6, 1) == "_") {
$host = "llnw";
}
// This routine is for pictures on the old Limelight Networks system, or using the naming scheme.
if ($host == "llnw") {
$iusplit = explode ("_", $imageurl);
if ($itype == "jpeg") {
if ($mode == "small") {
$iufinal = $iusplit[0] . "_s.jpg";
} elseif ($mode == "medium") {
$iufinal = $imageurl;
} elseif ($mode == "large") {
$iufinal = $iusplit[0] . "_l.jpg";
}
} elseif ($itype == "gif") {
if ($mode == "small") {
$iufinal = $iusplit[0] . "_s.gif";
} elseif ($mode == "medium") {
$iufinal = $imageurl;
} elseif ($mode == "large") {
$iufinal = $iusplit[0] . "_l.gif";
}
} elseif ($itype == "png") {
if ($mode == "small") {
$iufinal = $iusplit[0] . "_s.png";
} elseif ($mode == "medium") {
$iufinal = $imageurl;
} elseif ($mode == "large") {
$iufinal = $iusplit[0] . "_l.png";
}
}
}
// The new Akamai system is a bit more complicated than LLNW, but it has the same concept.
// I do like, however, that now you don't need to take the image format into consideration.
if ($host == "akamai") {
$iusplit = explode ("_", $imageurl);
$iprefix = substr ($iusplit[0], 0, (strlen($iusplit[0]) - 1));
if ($mode == "small") {
$iufinal = $iprefix . "s_" . $iusplit[1];
} elseif ($mode == "medium") {
$iufinal = $imageurl;
} elseif ($mode == "large") {
$iufinal = $iprefix . "l_" . $iusplit[1];
}
}
//echo ("" . $xml . "");
// Stolen from the manual, hacked extensively.
function loadpic ($imgname){
$im = file_get_contents ($imgname);
return $im;
}
//echo ("");
if ($itype == "jpeg") {
$ii = loadpic ($iufinal);
header ("Content-type: image/jpeg");
echo ($ii);
} elseif ($itype == "gif") {
$ii = loadpic ($iufinal);
header ("Content-type: image/gif");
echo ($ii);
} elseif ($itype == "png") {
$ii = loadpic ($iufinal);
header ("Content-type: image/png");
echo ($ii);
}
?>