items, 0, $num_items); # builds html from array foreach ( $items as $item ) { if(preg_match('', $item['description'],$imgUrlMatches)) { $imgurl = $imgUrlMatches[1]; # change to smaller pictures if (!$mediumPics) { $imgurl = str_replace("m.jpg", "s.jpg", $imgurl); } $title = $item['title']; $url = $item['link']; preg_match('', $imgurl, $flickrSlugMatches); $flickrSlug = $flickrSlugMatches[1]; # cache images if ($useImageCache) { # check if file already exists in cache if (!file_exists("$fullPath$flickrSlug.jpg")) { $filedata = ""; $remoteimage = fopen($imgurl, 'rb'); if ($remoteimage) { while(!feof($remoteimage)) { $filedata.= fread($remoteimage,1024*8); } } fclose($remoteimage); $localimage = fopen("$fullPath$flickrSlug.jpg", 'wb'); fwrite($localimage,$filedata); fclose($localimage); } print "" ."\"$title\"" ."\n"; } else { print "" ."\"$title\"" ."\n"; } } } } else { echo magpie_error(); } ?>