• Hi All

    I need to implement a solution to fetch 5 photos from flickr and display it on the website.

    I will have to use a custom field to populate with an album id so each post will display photos only relevant to the article posted.

    Any ideas are welcomed, I am loosing weight over this :/

    Thnks

Viewing 2 replies - 1 through 2 (of 2 total)
  • why don’t you use plugin ?

    Thread Starter umsuka

    (@umsuka)

    I have to pull photos based on albums and I thought having custom fields would be a good idea; the user will only enter the album id and the magic will happen in the background.

    I got it working now, the only problem now is showing a blank space when the custom field is empty and not render an error.

    <?php
    			require_once("phpFlickr.php");
    
    			$f = new phpFlickr("xxxxxxxxxxxxxxxxxxxxxxx");
    			$api_secret              = "xxxxxxxxxxxxxxxxxxxxxe";
    
    				$photoset_id = get_post_meta($post->ID, 'tham_fr', true);
    				$photos = $f->photosets_getPhotos($photoset_id);
    				$user_id  = "xxxxxxxxxxxxxxxxx";
    
    				 if ($f->getErrorCode())
    				{
    				echo "<pre>";
    				echo $f->getErrorCode().":".$f->getErrorMsg(). "\n";
    				print_r($photos);
    				print_r($f);
    				echo "</pre>";
    				}
    				foreach ($photos['photoset']['photo'] as $photo) {
    
    			$html .= "<a href='".$f->buildPhotoURL($photo, "large")."' title='".$photo['title']."' ></a>";
    			$html .= "<img border='0' alt='$photo[description]' src='".$f->buildPhotoURL($photo, "Square")."' id='photo_".$photo['id']."'></a>";
    
    			}
    
    				echo $html;
    		?>
Viewing 2 replies - 1 through 2 (of 2 total)

The topic ‘Fetch Flickr Photos’ is closed to new replies.