', '', $tag)); //Break the line apart and remove quotes $image=array(); foreach($tag as $detail){ //Go through the details of the photo if(strstr($detail, "=")){ //Pick out the lines that have an equals sign $detail=split("=", str_replace('"', '', $detail)); if(strstr($detail[0], " ")){$detaillabel=split(" ", $detail[0]); $detail[0]=$detaillabel[1];} //Catch first key that still has tag name $image[trim($detail[0])]=trim($detail[1]); //Compile an array of the details with meaningful keys } } return $image; } echo "\n\n"; if($apikey==""){ //No API key set echo '

ERROR: No API key has been defined.

'; }else{ if(isset($_GET['photo']) and isset($_GET['photoset'])){ // // INDIVIDUAL PHOTO // $photoinfo=file('http://api.flickr.com/services/rest/?method=flickr.photos.getInfo&api_key='.$apikey.'&photo_id='.$_GET['photo']); $photo=array(); $photo["desc"]=""; //Lazy bodge for multi-line descriptions $indesc=0; foreach($photoinfo as $line){ if(strstr($line, '')){$photo["title"]=trim(strip_tags($line));} if(strstr($line, '')){$line=trim($line);} if(strstr($line, '') or $indesc){$photo["desc"].=trim(str_replace("\n", "
", strip_tags($line))); $indesc=1;} if(strstr($line, '
')){$indesc=0;} if(strstr($line, '')){$photo["comments"]=trim(strip_tags($line));} if(strstr($line, '")){$photoset["title"]=trim(strip_tags($line));} if(strstr($line, "")){$photoset["desc"]=trim(strip_tags($line));} } //Get license info $licensedetails=file('http://api.flickr.com/services/rest/?method=flickr.photos.licenses.getInfo&api_key='.$apikey); $licenses=array(); foreach($licensedetails as $license){ if(strstr($license, "'.$photoset['.$photoset["title"].''."\n".'

'.html_entity_decode($photoset["desc"]).'

Return to the photoset list - Return to the photo list

'."\n\n"; if($userid==$photo["nsid"]){ echo '
'."\n\t".'

'.$photo["title"].'

'."\n\t".''.$photo['."\n\t"; if(array_key_exists("desc", $photo)){echo '

'.html_entity_decode($photo["desc"]).'

'."\n\t";} echo '
'."\n\t\t"; if(array_key_exists("tags", $photo)){ echo '

Tags: '; $tagcount=1; foreach($photo["tags"] as $tag){ if($tagcount>1){echo ', ';} echo ''; $tagcount++; } echo '

'."\n\t\t".'

Taken at '.date("g:i a", strtotime($photo["taken"])).' on '.date("jS F Y", strtotime($photo["taken"])).'

'."\n\t\t"; } echo ''."\n\t\t".'

View this photo on Flickr

'."\n\t".'
'."\n".'
'."\n"; }else{ //Photo does not belong to user echo '

ERROR: Photo does not appear to belong to the specified user.

'; } }elseif(isset($_GET['photoset']) and $_GET['photoset']>0){ // // INDIVIDUAL PHOTOSET // $pageurl=''; if(isset($perpage) and $perpage>0){ $pageurl.='&per_page='.$perpage; } if(isset($_GET['page']) and $_GET['page']>0){ $page=$_GET['page']; $pageurl.='&page='.$page; }else{ $page=1; } //Get list of photos $photoset=file('http://api.flickr.com/services/rest/?method=flickr.photosets.getPhotos&api_key='.$apikey.'&photoset_id='.$_GET['photoset'].'&extras=license%2C+date_upload%2C+date_taken%2C+owner_name%2C+icon_server%2C+original_format%2C+last_update'.$pageurl); $photolist=array(); foreach($photoset as $line){ if(strstr($line, "")){$photosetextra["title"]=trim(strip_tags($line));} if(strstr($line, '
')){$line=trim($line);} if(strstr($line, "") or $indesc){@$photosetextra["desc"].=trim(str_replace("\n", "
", strip_tags($line))); $indesc=1;} if(strstr($line, '
')){$indesc=0;} } $photosetdetails=array_merge($photosetdetails, $photosetextra); echo '

'.$photosetdetails['.$photosetdetails["title"].'

'."\n".'

'.html_entity_decode($photosetdetails["desc"]).'

Return to the photoset list

'."\n"; if($userid==$photosetdetails["owner"] and (!isset($layout) or $layout=="square")){ // // SQUARE THUMBNAIL PHOTOS // echo '
'."\n"; foreach($photolist as $photo){ echo "\t".''.$photo['."\n"; } echo '
'; }elseif($userid==$photosetdetails["owner"] and isset($layout) and $layout=="detail"){ // // DETAIL PHOTOS // $licensedetails=file('http://api.flickr.com/services/rest/?method=flickr.photos.licenses.getInfo&api_key='.$apikey); $licenses=array(); foreach($licensedetails as $license){ if(strstr($license, "'."\n"; foreach($photolist as $photo){ echo "\t".'

'.$photo["title"].'

'.$photo[
'."\n"; } echo '
'; }elseif(!($userid==$photosetdetails["owner"])){ // // PHOTOSET DOES NOT BELONG TO USERNAME // echo '

ERROR: Photoset does not appear to belong to the specified user.

'; }else{ // // INVALID PHOTO DISPLAY // echo '

ERROR: Invalid photo display option.

'; } // Previous/Next links if($photosetdetails["pages"]==1){ //Only one page echo '

Showing all '.$photosetdetails["photos"].' photos.

'; }else{ //More than one page if($photosetdetails["page"]>1){ $previous='< Previous'; }else{ $previous='< Previous'; } if($photosetdetails["page"]<$photosetdetails["pages"]){ $next='Next >'; }else{ $next='Next >'; } echo "\n".''."\n\t".''."\n\t".''."\n\t".''."\n".'
'.$previous.''.$next.'
'; } }else{ // // PHOTOSET LIST // $photosets=array(); //Get photoset details if(isset($userid) and strstr($userid, "@")){ $photosetlist=file('http://api.flickr.com/services/rest/?method=flickr.photosets.getList&api_key='.$apikey.'&user_id='.$userid); $indesc=0; foreach($photosetlist as $line){ if(strstr($line, "")){$photosets[$attributes["id"]]["title"]=trim(strip_tags($line));} if(strstr($line, "")){$line=trim($line);} if(strstr($line, "") or $indesc){@$photosets[$attributes["id"]]["desc"].=trim(str_replace("\n", "
", strip_tags($line))); $indesc=1;} if(strstr($line, '
')){$indesc=0;} } }else{ echo '

ERROR: Invalid User ID or User ID not set.

'; } //Handle preset list if(isset($presetphotosets) and count($presetphotosets)>0){ $allphotosets=$photosets; $photosets=array(); foreach($presetphotosets as $label => $id){ if(array_key_exists($id, $allphotosets)){ $photosets[$id]=$allphotosets[$id]; }else{ echo '

ERROR: Photoset '.$id.' ('.$label.') not found for user '.$userid.'.

'; } } } //Output photosets if(count($photosets)>0){ echo '
'."\n"; foreach($photosets as $photoset){ echo "\t".'
'.$photoset[

'.$photoset["title"].'

'.html_entity_decode($photoset["desc"]).'

'.$photoset["photos"].' photos - View on Flickr

'."\n"; } echo '
'; }else{ echo '

ERROR: No photosets found or no photosets specified.

'; } } if($photosetcols>1 and !isset($_GET['photoset'])){ ?>

Powered by GalsingFlickr