You can load public images from a public Flickr account or a photoset and show them as a slider. To create a Flickr slider, first, you need to create a template for the slider. Its markup is very similar to a custom slider markup. The snippet below defines a slider template:
<div class="master-slider ms-skin-default" id="masterslider"> <div class="ms-slide"> <img src=".../path/to/blank.gif" data-src="{{image}}" alt="{{title}}"/> <img class="ms-thumb" src="{{thumb}}" alt="{{title}}"/> <p class="ms-layer" style="background:rgba(255,255,255,0.5); padding: 20px;" data-type="text" data-offset = "{origin:bl; x:50px; y:50px;}" > {{title}}<br> {{description}}<br> by:{{owner-name}} <br> date:{{date-taken}} </p> </div> </div>
As you can see in the example above, you just need to define one slide in the slider and specify dynamic parts by dynamic tags
. Dynamic tags will be replaced by the related content after loading data from Flickr.
As demonstrated in the example, dynamic tags specifies by locating between
{{
and
}}
Supported dynamic tags
Dynamic tag | Description |
{{title}} |
Photo title |
{{thumb}} |
Photo thumbnail path |
{{image}} |
Original photo path |
{{owner-name}} |
Photo’s owner name |
{{date-taken}} |
Photo’s date taken |
{{views}} |
Photo views |
{{description}} |
Photo description |
Setup Flickr gallery
After specifying the slider markup, you need to set the Flickr images source and API data. You can set them after the slider JS setup. Below you can find an example.
var slider = new MasterSlider(); slider.control('arrows'); slider.control('bullets'); slider.control('thumbnails' , { width:127, height:137, arrows:false fillMode:'fill' }); slider.setup('masterslider' , { width:900, height:600, space:5, fillMode:'fit' }); MSFlickrGallery.setup(slider, { key:'[Your Flickr API Key]', id:'[Photoset ID or User ID]', count:15, imgSize:'o' });
As demonstrated in the example, to setup Flickr gallery you need to useMSFlickrGallery.setup
. This method has two parameters. First parameter is the instance of the slider and second one is Flickr api options.
Flickr API parameters
Option
|
Default
|
Description
|
---|---|---|
key | null | Specifies the Flickr API key |
ID | null | Specifies the photoset ID or the user ID depends on what is specified for type parameter.For finding the user ID you can take a look at this page. And you can find the photoset ID from photoset page URL. For more information check out?this article. |
type | “photoset” | This option accepts two values “photoset” and “latest”, “photoset” for showing photoset pictures and “latest” for showing the latest pictures. |
imgSize | “c” | This option accepts four values “-“, “z”, “c” and “b” ,
“-” for medium size with dimension of 500 on longest side, “z” for medium size with dimension of 640 on longest side, “c” for medium size with dimension of 800 on longest side, and “b” for large size with dimension of 1024 on longest side. |
thumbSize | “q” | This option accepts three values “s”, “q” and “t” ,
“s” for small square with dimension of “75×75”, “q” for large square with dimension of “150×150” and “t” for thumbnail with dimension of 100 on longest side. |
count | 10 | The number of images. It helps the slider to put exact number of pictures. |