Skip to main content

How To Easily Resize The Blogger Popular Posts Thumbnail Image Size


The Popular Posts Gadget


If you are reading this post you probably know that the Blogger Popular Posts gadget presents the option to include thumbnail images of the listed popular posts.

The default size of the thumbnail images is 72 pixels high by 72 pixels wide. There is no option to change the size of the thumbnails from the gadget settings and if you change the width and height attributes of img tag in your Blogger Template the images will be stretched and low quality.

The reason for this is that Blogger stores it's images using the Picasa web service and when the images are required for the Popular Posts gadget it calls them at a 72 by 72 resolution.



The Popular Posts Thumbnails


The resolution of the Popular Posts Thumbnails can be also seen by looking at the image url. As an example let us have a look at the Thumbnail image of one of the Posts from this Blog.

The link for the thumbnail image of the How To Completely Backup Your Blogger Data post is the following:

If you click on this image you will see the 72 by 72 pixel image. The image size is indicated in the link itself  s72-c. If you were to take the same link and change s72-c to s500-c you would get this:
Which, as you can see, displays a 500 by 500 pixel version of the thumbnail image.

To see the original image you just have to change s72-c to s1600, getting:

Note that any link containing "-c" after the indicated image size will be displayed as a square so if you need to keep the original aspect ratio you will have to remove the "-c".




Why Would You Want To Change The Thumbnail Size?


By tweaking the Popular Posts Gadget code a bit you could create a better style to match your Blogger template or you could go even further and create a Popular Posts Carousel Gadget for your blogs header, like the one on the homepage of this blog.

I will soon write a tutorial on creating a Blogger Popula Posts Carousel so follow me on one of the social networks or subscribe by e-mail to get the latest updates.



What Is The Easiest Way To Change The Thumbnail Size


After finding a few pretty complicated methods online i have decided to write a tutorial presenting an easier method:

We will add a class to the thumbnail image in the Popular Posts loop in order to easily identify them later. After adding the class we will use javascript to find s72-c and replace it with the desired code.

1. Go to Template --> Edit HTML, find and expand the Popular Posts widget.

2. Hit Ctrl + F, or Cmd + F if you are using a Mac, and search for this code expr:src='data:post.thumbnail'.

3. As you can see this but of code generates the src tag of the Thumbnail image. Add the class resizethumbnail to the image tag, like this: class="resizethumbnail".

4. Now scroll down to the closing of the body tag and add this bit of javascript before it:

<script type='text/javascript'>
$(document).ready(function() {$('.resizethumbnail').attr('src', function(i, src) {return src.replace( 's72-c', 's500-c' );});});
</script>

This will now resize all thumbnails to a 500 by 500 pixel resolution.

5. To get the image at the original aspect ratio use the javascript below:

<script type='text/javascript'>
$(document).ready(function() {$('.resizethumbnail').attr('src', function(i, src) {return src.replace( 's72-c', 's1600' );});});
</script>


Please leave any other questions you might have in the comments section below.

Comments

Popular posts from this blog

iPhone 5 Rumor Roundup

Release Date The latest rumors regarding the iPhone 5 indicate that the official release date will be officially announced during the next Apple event which is to be held on September 12th 2012. According to Verizon CFO, Fran Shammo, Apple (AAPL) will stick to last year's release date and launch the iPhone 5 in October 2012. Although during the 2012 WWDC we had the opportunity to get some more details about iOS 6, no hardware specifications were released. source - 9to5mac.com Larger Screen The iPhone 5 is rumoured to have a larger, 4 inch retina display. source - Apple.pro Nano SIM According to the Financial Times, mobile carriers in Europe are stocking up on Nano SIM cards. This might be related to the release of the next generation iPhone. Smaller Dock Connector Another wide spread rumour is that Apple will release the iPhone 5 with a smaller, 8 pin dock connector. This means that new cables will be available for  new Apple devices released in the future. Did you hear any new rum...

Single Page HTML5 CSS3 Business Card Template 2.0

After seeing a huge interest in the Single Page Business Card Tutorial  i decided to create a Single Page Business Card 2.0 Template. Besides listing your title and contact details the 2.0 template also has some nice CSS3 transition effects, is available in 4 colors and the best part: IT'S FREE FOR DOWNLOAD . Demo Download CSS3 Transition Effect On hover the Name/Title block and the Contact Details blocks slide out vertically showing a centered block containing name and position, social and contact icons. Red Template Demo Blue Template Demo Yellow Template Demo Green Template Demo

HTML Codes for Romanian Characters

Character Simple Code Numerical Code Hex Code Ă &#258; &#x102; ă &#259; &#x103; Â &Acirc; &#194; &#xC2; â &acirc; &#226; &#xE2; Î &Icirc; &#206; &#xCE; î &icirc; &#238; &#xEE; Ș &#x218; &#xDA; ș &#x219; &#xDB; Ş &#350; &#x15E; ş &#351; &#x15F; Ţ &#354; &#x162; ţ &#355; &#x163;