topical media & game development
server-webapi-code-03-linkUtilityFunctions.php / php
<?php
function getPathOnly(path, -1, 1) == "/")
{
return pathComponents = explode("/", count = count(last = count - 1];
if (substr_count(pathComponents);
}
pathComponents);
return sourceURL, sup = parse_url(sup['scheme']))
{
sourceURL;
sourceURL);
}
sup['scheme'] . "://" . sup['path']);
link, 0, 1);
if(link, 0, 2) == "./")
{
sourceURL . substr(link, 0, 3) == "../")
{
sourceURL);
sup['path']);
array_pop(link, 0, 3) == "../") & (count(x = array_pop(link = substr(final = sup['host'] . implode("/", link;
}else
{
sourceURL . start == "/")
{
sup['scheme'] . "://" . link;
}else if (substr_count(final = link;
}else
{
link;
}
return processedFeed = preg_replace('/<img\s+.*?src="([^\"\' >]*)"\s?(width="([0-9]*)")?\s?(height="([0-9]*)")?[^>]*>/ie',
"cleanImage('feed);
function cleanImage(entireMatch, widthE, heightE, link = relativeToAbsolute(link);
return "<img src=\"h\" width=\"sourceURL, link, w, h)
{
sourceURL, link\" title=\"Inline Image\">(image)</a>";
}
function retreiveImages(entireMatch, widthE, heightE, localSavePath = "/www/domains/feedimages.preinheimer.com/";
link = relativeToAbsolute(link);
link);
link);
localSavePath . filepath, image = null;
@list(lheight, lattr) = getimagesize(lwidth * w < 1)
{
lwidth;
}
if (h = localImageURL . w\" height=\"link\">";
/* Confirming it's an image, then deleting it
unlink(link . "\" width=\"h\">";
*/
}
sourceURL', '\\1', '\\3', '\\4')",
sourceURL, title, link = relativeToAbsolute(link);
return "<a href=\"title\">sourceURL, title, link = relativeToAbsolute(link);
return "<a href=\"title\">link)";
}
?>
(C) Æliens
20/2/2008
You may not copy or print any of this material without explicit permission of the author or the publisher.
In case of other copyright issues, contact the author.