My favorites | Sign in
Project Logo
                
Search
for
Updated Sep 09, 2008 by joetan54
HowTo  
Quick tips to customize and use the Flickr Photo Album plugin

Code Snippets

Retrieve Recent Photos

Retrieve recent photos. Could be used as a photo stream or just display your most recent photos uploaded. Default parameters are shown in the getRecentPhotos() function call.

<?php
require_once(dirname(__FILE__).'/../../plugins/tantan-flickr/flickr/class-public.php');
$TanTanFlickrPlugin =& new TanTanFlickrPlugin();
$photos = $TanTanFlickrPlugin->getRecentPhotos($tags='', $offsetpage=0, $max=15, $everyone=false);
?>

Get recent photos and randomly display some

This code block retrieves your 40 most recent photos, randomizes the order, and then displays 20 photos. Note that each photo links to "/photos/", and will probably have to be updated to reflect your own settings.

<?php
require_once(dirname(__FILE__).'/../../plugins/tantan-flickr/flickr/class-public.php');
$TanTanFlickrPlugin =& new TanTanFlickrPlugin();
$photos = $TanTanFlickrPlugin->getRecentPhotos('', 0, 40);
shuffle($photos);
?>
<?php foreach (array_slice($photos, 0, 20) as $photo):?>
<a href="/photos/photo/<?php echo $photo['id'];?>/<?php echo $photo['pagename'];?>"
class="photo"><img src="<?php echo $photo['sizes']['Square']['source'];?>"
width="<?php echo $photo['sizes']['Square']['width'];?>" height="<?php echo $photo['sizes']['Square']['height'];?>" /></a>
<?php endforeach;?>

Test if you're in a Flickr gallery page

Use this snippet to see if your inside a Flickr gallery page from within another WordPress template.

global $TanTanFlickrPlugin;
if (is_object($TanTanFlickrPlugin)) {
    // ... do stuff ...
}

Comment by yago.veith, Dec 28, 2007

Automatic width and height "detection" and

<?php foreach (array_slice($photos, 0, 4) as $photo):?>
<a href="<?echo dirname($PHP_SELF);?>/flickr/photo/<?php echo $photo['id'];?>/<?php echo $photo['pagename'];?>"
class="photo"><img src="<?php echo $photo['sizes']['Small']['source'];?>"
width="<?php echo $photo['sizes']['Small']['width']?>" height="<?php echo $photo['sizes']['Small']['height']?>" /></a>
<?php 

// php echo $sizes['Square']['source'];
// php echo $photo['Small']['source'];
// php echo $sizes['Medium']['source'];
Comment by jeremysbell, May 26, 2008

Does anyone know how to limit "getRecentPhotos" to a single set or collection? At the moment, it pulls in photos from your main stream, but I want to limit the scope.

any ideas?

Comment by jesirose, Sep 20, 2008

I also want to get just a single set.

Comment by Photolord, Sep 26, 2008

In albums, how would I utilize the words "Next" and "Previous" next to "View Slideshow" so the user could get the next or previous photos? It would be at the top navigation menu on albums. Any Ideas?

Comment by photolarry1, Oct 20, 2008

How do I use the popup lightbox? I added the code to wp-config but nothing has changed.

Comment by xtremetoonz, Dec 06, 2008

I also would like to be able to chose a set or collection for the sidebar display.

Comment by Mary.lili33, Sep 03, 2009

p><a href="http://www.pumaword.com/">puma shoes </a> </p> <p><a href="http://www.pumaword.com/womens-puma-future-cat-low-c-514.html">Women's Puma Future Cat Low </a> </p> <p> <a href="http://www.pumaword.com/womens-puma-engine-cat-low-c-503.html">Women's Puma ENGINE Cat Low </a> </p> <p> <a href="http://www.pumaword.com/mens-puma-trionfo-lo-l-ii-c-521.html">Men's Puma TRIONFO LO L II </a> <br> </

Comment by diegolopezortiz, Oct 10, 2009

Is a way to refresh all albums using cron?? I would like to refreh them at night without using the menu :)


Sign in to add a comment
Hosted by Google Code