I notice a growing trend towards using pictures to link to posts. Pinterest effect perhaps? Anyway, some people code the pictures listing manually in a HTML/Javascript gadget to form a gallery, while others painstakingly add one picture at a time using a Picture gadget. It's a pain.
But there is a good news: you can now list the pictures easily andautomatically using our recent posts image gallery widget. Perfect for listing recipes, design projects and other photo-centric posts.
Below are some the features of the gallery:
- You can set your preferred image size, any size. Image will come out sharp, no pixelation.
- Light -what you see is what actually loaded. Most image galleries take forever to load because they load full size images and then shrink them using CSS. This gallery loads the correct image size the first time.
- Posts can be filtered using a label.
- Support multiple galleries. The options (thumb size and post title overlay) can be set independently for each gallery.
Installation
- First go to Template > Edit HTML and add this script before the
</head>tag in your template.01<script>02// Blogger Recent Posts Gallery by Bloggersentral.com03// Tutorial at http://www.bloggersentral.com/2013/05/recent-posts-image-gallery-for-blogger.html04// Free to use or share, but please keep this notice intact.05//<![CDATA[06function bsrpGallery(root) {07var entries = root.feed.entry || [];08var html = ['<div class="bsrp-gallery nopin" title="Get this from BloggerSentral.com">'];09for (var i = 0; i < entries.length; ++i) {10var post = entries[i];11var postTitle = post.title.$t;12var orgImgUrl = post.media$thumbnail ? post.media$thumbnail.url : 'https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjAS2sQmTBiQ83gcpW-FfyRf2VTWmDvAX5_X6bFVRxoLbopVBgrWmd-4ZylQeb1emEs9LU8DFpyAx0ZqktYtqFGjqFaFtMfd0laOACgJBn_OfzJH_WRe3ZxqW7WqfqngmDYFQVYQWqmnmiD/s72-c/default+image.png';13var newImgUrl = orgImgUrl.replace('s72-c', 's' + bsrpg_thumbSize + '-c');14var links = post.link || [];15for (var j = 0; j < links.length; ++j) {16if (links[j].rel == 'alternate') break;17}18var postUrl = links[j].href;19var imgTag = '<img src="' + newImgUrl + '" width="' + bsrpg_thumbSize + '" height="' + bsrpg_thumbSize + '"/>';20var pTitle = bsrpg_showTitle ? '<span class="ptitle">' + postTitle + '</span>' : '';21var item = '<a href="' + postUrl + '" target="_blank" title="' + postTitle + '">' + imgTag + pTitle + '</a>';22html.push('<div class="bs-item">', item, '</div>');23}24html.push('</div>');25document.write(html.join(""));26}27//]]>28</script> - Then, add the following CSS code into the CSS section of your template (right before
</b:skin>tag).1/* BloggerSentral Recent Posts Image Gallery CSS Start */2.bsrp-gallery {padding:10px;clear:both;}3.bsrp-gallery:after {content:"";display: table;clear:both;}4.bsrp-gallery .bs-item a {position:relative;float:left;margin:015px15px0!important;text-decoration:none;}5.bsrp-gallery .bs-item .ptitle {background: rgba(0,0,0,0.5);background:#7f7f7f\9;display:block;clear:left;font-size:11px;line-height:1.3em;height:2.6em;position:absolute;text-align:left;bottom:10%;color:#fff;padding:2px5px; word-wrap: break-word;overflow:hidden;}6.bsrp-gallery a img {background:#eee;float:left;padding:5px; box-shadow:1px1px3pxrgba(0,0,0,0.5); -moz-box-shadow:1px1px3pxrgba(0,0,0,0.5); -webkit-box-shadow:1px1px3pxrgba(0,0,0,0.5); transition: background-color0.4s; -webkit-transition: background-color0.4s; -moz-transition: background-color0.4s;}7.bsrp-gallery a:hover img {background:#ee7e22;}8/* BloggerSentral Recent Posts Image Gallery CSS End */If you prefer to put the CSS together with the scripts (in a post or in a HTML/Javascript gadget), you must enclose it in a</script>tag. - Finally add this script wherever you want the gallery to appear. It can be added anywhere -in a post, a page or a HTML/Javascript widget.
1<script>2var bsrpg_thumbSize = 150;3var bsrpg_showTitle = true;4</script>5<scriptsrc="/feeds/posts/summary?max-results=8&alt=json-in-script&callback=bsrpGallery"></script>- Set the image size (in pixel) in line 2.
- Set line 3 to
trueto add post title overlay on each image. False will display image without overlay. However, in both cases, the post title will appear in the tooltip that pops up when you hover the image. - To display recent posts under a label (e.g.
RECIPE), replace the base URL for the src attribute with the label feed URL, like so:/feeds/posts/summary/-/RECIPE - Set the number of posts to be displayed by changing the value of
max-resultsquery parameter.
Demo
Below are two live demo galleries.
This one shows the latest 10 posts from Blogger Sentral's general feed (
/feeds/posts/summary). Image size is set to 100px, and post title overlay is set to false.This one displays the latest 6 posts from Blogger Sentral's "widgets" label feed (
/feeds/posts/summary/-/widgets). Image size is set to 140px, and post title overlay is set to true.Enjoy!













