Automatic Blogger Post Photo Resize Script - Andi AM Script V.2
ooredoo

Tuesday, March 12, 2024

Home » Blogger , Blogger Tips » Automatic Blogger Post Photo Resize Script - Andi AM Script V.2

Automatic Blogger Post Photo Resize Script - Andi AM Script V.2

How to Blogger - Template Design (Automatic image resizing)
Hello blogger friends, on this occasion AM will share the ultimate script forautomatically resizing blogger images.

Maybe someone asks, what are the benefits of this image resizing script?
The benefits are quite numerous, including:
  1. Automatically resizes all post images.
  2. The image quality will not change, aka it will not be blurry.
  3. Very suitable for SEO Friendly blogs
  4. Very good for photo gallery blogs.
  5. Blog post images are organized and pleasing to the eye.
OK, without further ado, here is the script "Andi AM V.2"
Place the script below right above the code </head>
Press (Crrl+f) to find the code.
Please change the red code according to the width of the image you want.

<!-- Script Andi AM - Resize Img Src Thumb V.2a -->
<script type='text/javascript'>//<![CDATA[
$(document).ready(function(){
    // the dimension of your content within the columns
    var areawidth = $('#Blog1').width();
    $('.post-body').find('img').each(function(n, image){
        var image = $(image);
        var height = image.attr('height');
        var width = image.attr('width');
        var newHeight = (height/width * areawidth).toFixed(0);
        image.attr(' width', 480 ).attr('height',newHeight);
        var greater = Math.max(480,newHeight);
        image.attr({src : image.attr('src').replace(/s\B\ d{3,4}/,'s' + greater)});
    });
});
//]]></script>
<!-- Script Andi AM - Resize Img Src Thumb V.2a -->

Try saving your template, is it successful or not, if not, please add the next script code below and place it above the code </body>
Please change the red code according to the width of the image you want.

<!-- Script Andi AM - Resize Img Src Thumb V.2b -->
<script>
//<![CDATA[
function resizeThumb(parentID, size) {
    var parent = document.getElementById(parentID),
        image = parent. getElementsByTagName('img');
    for (var i = 0; i < image.length; i++) {
        image[i].src = image[i].src.replace(/\/s72\-c/, "/s" +

size + "- c");
        image[i].width = size;
        image[i].height = size;
    }
} resizeThumb('Blog1', 480 );
//]]>
</script>
<!-- Script Andi AM - Resize Img Src Thumb V.2b -->

Please save your template, and try to see the results again, if it still doesn't work then there are several possible errors including:
  1. The jquery script for your blog template is not yet available, the solution is to copy the jquery script provided here (in red) right above the </head> code as above.
    <script language='javascript' src='https://ajax.googleapis.com/ajax/libs/jquery/1.6.4/jquery.min.js' type='text/javascript'/>
  2. The second error could be that the two Andi AM V.2 resize image scripts above are not recognized by your blog template. The solution is please try the Andi AM V.3 or V.4 image resize script.
  3. If there is still no change, then another possibility is because your template design was specially designed by the owner. This incident is usually suffered by blogs that predominantly use CC3.
  4. Our advice, you should not use free templates that have a premium, meaning premium templates but free versions are also available, templates like this are usually very messy and have irregular CSS, even lots of hidden code and scripts.
Hopefully this article can help, please continue to monitor our updates.
Regards - Andi AM

Related Posts :