JQuery UI Tips

From QwikITedia

Jump to: navigation, search

Contents

Galleria + Flickr

How to suck down your images from Flickr and display them using the very magnificent Galleria jQuery based gallery

Assumptions

Add Flickr images to Galleria

<html>
<head>
<title>Test Flickr-Galleria</title>
</head>
<body>
 <div id="galleria"></div>
</body>
</html>
<html>
<head>
<title>Test Flickr-Galleria</title>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js"></script>
</head>
<body>

 <div id="galleria"></div>
</body>
</html>
<html>
<head>
<title>Test Flickr-Galleria</title>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js"></script>
<script src="src/galleria.js"></script>
</head>
<body>

 <div id="galleria"></div>
</body>
</html>
<html>
<head>
<title>Test Flickr-Galleria</title>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js"></script>
<script src="src/galleria.js"></script>
<script src="src/plugins/galleria.flickr.js"></script>

</head>
<body>

 <div id="galleria"></div>
</body>
</html>
<html>
<head>
<title>Test Flickr-Galleria</title>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js"></script>
<script src="src/galleria.js"></script>
<script src="src/plugins/galleria.flickr.js"></script>

</head>
<body>

 <div id="galleria"></div>

<script type="text/javascript">

    // Load theme
    Galleria.loadTheme('src/themes/classic/galleria.classic.js');
    
    var api_key = '38d2d12d9f0a49737650cb31d26be725'; // you must have a flickr API key
    var flickr = new Galleria.Flickr(api_key); // initialize the plugin

		// Get your photoset - each set has an ID.. check URL in Flickr for specific set ID
		flickr.getSet('72157603181020473', {
		size: 'medium',
		description: true // set this to true to fetch flickr descriptions
		}, function(data) {
		$('#galleria').galleria({
		data_source: data, // add the flickr data
		show_imagenav: true, // the prev/next arrows
		debug:true,
		height: 500
		});
		}); 


</script>

</body>
</html>

Troubleshooting

If your Flickr images are not showing up here are some likely causes:

  1. You forgot to load a theme:

Galleria.loadTheme('src/themes/classic/galleria.classic.js');

  1. Your API key has not been called out as a string - you omitted the quotes around it:

   var api_key = 38d2d12d9f0a49737650cb31d26be725;

  1. You have omitted some semicolons:

   var api_key = '38d2d12d9f0a49737650cb31d26be725'

  1. You have the wrong set ID (sometimes called Set Reference) or no quotes around it:

flickr.getSet(72157603181020473, {

  1. You omitted the height attribute in the Options area - Without this your Galleria might not show up, this is what got me - d'oh!!
height: 500

Note

Personal tools
Namespaces
Variants
Actions
Richard Esmonde.com
Wiki Navigation
Toolbox