How to get a list of images in a size of 200px in Blogger?

Asked

Viewed 16 times

0

I have the function below that provides me an array with a series of Blogger posts with the appropriate images, links and titles of these said posts, and the images come with the size of 72px.

I’ve seen similar questions here in the OS, I’ve used some scripts that force this resizing (but these only work when on the console; I’ve put the script on the sheet, but nothing!).

In short, is there any way to change the very script that provides me this data to make the images already come with a size of 200px? I already tested some changes in the variable img, but unsuccessfully so far.

    function grabList(json) {
    var list = json.feed.entry, link, img, sum, skeleton = "";
    if (typeof list !== "undefined") {
        for (var i = 0; i < list.length; i++) {
            for (var j = 0; j < list[i].link.length; j++) {
                if (list[i].link[j].rel == "alternate") {
                    link = list[i].link[j].href;
     title = list[i].title.$t;
                    break;
                }
            }

            img = ("media$thumbnail" in list[i]) ? list[i].media$thumbnail.url : widget_config.no_thumb;
            skeleton += '<li>';
            skeleton += '<div class="pthumb"><a rel="nofollow" href="' + link + '"><img alt="' + title +'" title="' + title + '" src="' + img + '"></a></div>';
            skeleton += '<a rel="nofollow" href="' + link + '" title="' + title + '">' + title + '</a>';
            skeleton += '</li>';
        }
        inner.innerHTML += skeleton; 
        loading.style.display = "none";
    } else {
        loading.className += ' the-end';
        loading.textContent = widget_config.end_text;
    }
}

1 answer

0


I ended up discovering how it is. I created a new variable called imgmaior:

    imgmaior = img.replace("/s72-c/","/w200/");

And replaced the variable img by the new imgmaior in the attribute src of the code. And it worked!

Browser other questions tagged

You are not signed in. Login or sign up in order to post.