{"title":"Loading Flickr Images","id":52026,"link":"https:\/\/env.averta.net\/en\/step\/loading-flickr-images\/","parent":[51854],"content":"<p>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:<\/p>\n<pre class=\"lang:xhtml decode:true \">  &lt;div class=\"master-slider ms-skin-default\" id=\"masterslider\"&gt;\r\n      &lt;div class=\"ms-slide\"&gt;\r\n          &lt;img src=\"...\/path\/to\/blank.gif\" data-src=\"{{image}}\" alt=\"{{title}}\"\/&gt;           \r\n          &lt;img class=\"ms-thumb\" src=\"{{thumb}}\" alt=\"{{title}}\"\/&gt;\r\n          &lt;p class=\"ms-layer\"\r\n            style=\"background:rgba(255,255,255,0.5); padding: 20px;\"\r\n            data-type=\"text\"\r\n            data-offset = \"{origin:bl; x:50px; y:50px;}\"\r\n          &gt;\r\n            {{title}}&lt;br&gt;\r\n            {{description}}&lt;br&gt;\r\n            by:{{owner-name}} &lt;br&gt;\r\n            date:{{date-taken}}\r\n          &lt;\/p&gt;\r\n      &lt;\/div&gt;\r\n  &lt;\/div&gt;<\/pre>\n<p>As you can see in the example above, you just need to define one slide in the slider and specify dynamic parts by <code>dynamic tags<\/code>. Dynamic tags will be replaced by the related content after loading data from Flickr.<br \/>\nAs demonstrated in the example, dynamic tags specifies by locating between<br \/>\n<code>{{<\/code> and<br \/>\n<code>}}<\/code><\/p>\n<h2>Supported dynamic tags<\/h2>\n<table>\n<thead>\n<tr>\n<td>Dynamic tag<\/td>\n<td>Description<\/td>\n<\/tr>\n<\/thead>\n<tbody>\n<tr>\n<td><code>{{title}}<\/code><\/td>\n<td>Photo title<\/td>\n<\/tr>\n<tr>\n<td><code>{{thumb}}<\/code><\/td>\n<td>Photo thumbnail path<\/td>\n<\/tr>\n<tr>\n<td><code>{{image}}<\/code><\/td>\n<td>Original photo path<\/td>\n<\/tr>\n<tr>\n<td><code>{{owner-name}}<\/code><\/td>\n<td>Photo&#8217;s owner name<\/td>\n<\/tr>\n<tr>\n<td><code>{{date-taken}}<\/code><\/td>\n<td>Photo&#8217;s date taken<\/td>\n<\/tr>\n<tr>\n<td><code>{{views}}<\/code><\/td>\n<td>Photo views<\/td>\n<\/tr>\n<tr>\n<td><code>{{description}}<\/code><\/td>\n<td>Photo description<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<h2>Setup Flickr gallery<\/h2>\n<p>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.<\/p>\n<pre class=\"lang:xhtml decode:true \">    var slider = new MasterSlider();\r\n \r\n    slider.control('arrows');  \r\n    slider.control('bullets');\r\n    slider.control('thumbnails' , {\r\n          width:127,\r\n          height:137,\r\n          arrows:false\r\n          fillMode:'fill'\r\n    });\r\n  \r\n    slider.setup('masterslider' , {\r\n        width:900,\r\n        height:600,\r\n        space:5,\r\n        fillMode:'fit'\r\n    });\r\n\r\n    MSFlickrGallery.setup(slider, {\r\n      key:'[Your Flickr API Key]',\r\n      id:'[Photoset ID or User ID]',\r\n      count:15,\r\n      imgSize:'o'\r\n    });<\/pre>\n<p>As demonstrated in the example, to setup Flickr gallery you need to use<code>MSFlickrGallery.setup<\/code>. This method has two parameters. First parameter is the instance of the slider and second one is Flickr api options.<\/p>\n<h2>Flickr API parameters<\/h2>\n<table>\n<thead>\n<tr>\n<th>\n<div>Option<\/div>\n<\/th>\n<th>\n<div>Default<\/div>\n<\/th>\n<th>\n<div>Description<\/div>\n<\/th>\n<\/tr>\n<\/thead>\n<tbody>\n<tr>\n<td>key<\/td>\n<td>null<\/td>\n<td>Specifies the Flickr API key<\/td>\n<\/tr>\n<tr>\n<td>ID<\/td>\n<td>null<\/td>\n<td>Specifies the photoset ID or the user ID depends on what is specified for <code>type<\/code> parameter.<br \/>\nFor finding the user ID you can take a look at <a class=\"external-link\" href=\"http:\/\/idgettr.com\/\" rel=\"nofollow\">this page<\/a>.<br \/>\nAnd you can find the photoset ID from photoset page URL. For more information check out?<a class=\"external-link\" href=\"http:\/\/env.averta.net\/envato\/knowledgebase\/find-id-photoset-flickr\/\" rel=\"nofollow\">this article<\/a>.<\/td>\n<\/tr>\n<tr>\n<td>type<\/td>\n<td>&#8220;photoset&#8221;<\/td>\n<td>This option accepts two values &#8220;photoset&#8221; and &#8220;latest&#8221;, &#8220;photoset&#8221; for showing<br \/>\nphotoset pictures and &#8220;latest&#8221; for showing the latest pictures.<\/td>\n<\/tr>\n<tr>\n<td>imgSize<\/td>\n<td>&#8220;c&#8221;<\/td>\n<td>This option accepts four values &#8220;-&#8220;, &#8220;z&#8221;, &#8220;c&#8221; and &#8220;b&#8221; ,<\/p>\n<p>&#8220;-&#8221; for medium size with dimension of 500 on longest side,<\/p>\n<p>&#8220;z&#8221; for medium size with dimension of 640 on longest side,<\/p>\n<p>&#8220;c&#8221; for medium size with dimension of 800 on longest side,<\/p>\n<p>and &#8220;b&#8221; for large size with dimension of 1024 on longest side.<\/td>\n<\/tr>\n<tr>\n<td>thumbSize<\/td>\n<td>&#8220;q&#8221;<\/td>\n<td>This option accepts three values &#8220;s&#8221;, &#8220;q&#8221; and &#8220;t&#8221; ,<\/p>\n<p>&#8220;s&#8221; for small square with dimension of &#8220;75&#215;75&#8221;,<\/p>\n<p>&#8220;q&#8221; for large square with dimension of &#8220;150&#215;150&#8221;<\/p>\n<p>and &#8220;t&#8221; for thumbnail with dimension of 100 on longest side.<\/td>\n<\/tr>\n<tr>\n<td>count<\/td>\n<td>10<\/td>\n<td>The number of images. It helps the slider to put exact number of pictures.<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n","type":"solution"}