$cacheLife)
unlink($imagesdir.$file);
}
}
//Check if Flickr is alive
$youHeaders = get_headers($feedURL);
if (preg_match('/^HTTP\/\d\.\d\s+(200)/', $youHeaders[0])) {
if ( $cachexml )
{
// Filename for the retrieved rss feed
$cachefile = $imagesdir . $userid .'.xml';
// Check if exists
if (file_exists($cachefile) AND (filemtime($cachefile) > time() - $cacheLife))
{
//Read feed into SimpleXML object
$sxml = simplexml_load_file($cachefile);
} else {
if(function_exists('curl_init')){
$chf = curl_init();
$timeout = 15; // set to zero for no timeout
curl_setopt ($chf, CURLOPT_URL, $feedURL);
curl_setopt ($chf, CURLOPT_RETURNTRANSFER, 1);
curl_setopt ($chf, CURLOPT_CONNECTTIMEOUT, $timeout);
$feedcontents = curl_exec($chf);
curl_close($chf);
} else {
$feedcontents = file_get_contents($feedURL);
}
// Write to disk and save the filename
file_put_contents($cachefile, $feedcontents);
//Read cach feed into SimpleXML object
$sxml = simplexml_load_file($cachefile);
}
} else {
//Read feed into SimpleXML object
$sxml = simplexml_load_file($feedURL);
}
// get nodes in media: namespace for media information
$media = $sxml->entry->children('http://www.w3.org/2005/Atom');
if(@empty($media)){
$notube = "Sorry, no pictures found !";
}
foreach ($sxml->entry as $entry) {
// get nodes in media: namespace for media information
$media = $entry->children('http://www.w3.org/2005/Atom');
// get video titles
$titles = $media->title;
$titles = str_replace(array(' ', '&', '’', '“', '”', '`', '"', "'",), array('', ' ', '', '', '', '', ''), $titles);
// get thumbnail
$thumbnail = $media->content;
//Get the urls out of the page
preg_match_all("/src=\"(.*?)\"/", $thumbnail, $matches);
foreach($matches[1] as $thumbnails)
{
$thumbnails;
}
//Links for bigger 500 size pictures
$links = str_replace("_m", "", $thumbnails);
//First let's first get the picture name's to see if it's already there
$path = explode('/', $thumbnails);
$filename = $path[count($path)-1];
$youname = $imagesdir.$filename;
//If already there skip the download
if (!file_exists($youname)) {
//Get the biggest picture availible
if(function_exists('curl_init')){
$ch = curl_init();
$timeout = 15; // set to zero for no timeout
curl_setopt ($ch, CURLOPT_URL, $thumbnails);
curl_setopt ($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt ($ch, CURLOPT_CONNECTTIMEOUT, $timeout);
$contents = curl_exec($ch);
curl_close($ch);
} else {
$contents = file_get_contents($thumbnails);
}
//Get the picture's name again
$path = explode('/', $thumbnails);
$filename = $path[count($path)-1];
//Put it in the cache dir and give it a file name
$youname = $imagesdir.$filename;
//Write the file to disk
file_put_contents($youname, $contents);
}
//For more information about the php reflection and settings got to http://reflection.corephp.co.uk
?>

&cache=1&procent=0.7" longdesc="=$links; ?>" alt="= html_entity_decode(utf8_decode($titles)); ?>" title="Click on the picture to expand"/>
=( isset($notube) ? $notube : '' ); ?> =( isset($notubexml) ? $notubexml : '' ); ?>