为了账号安全,请及时绑定邮箱和手机立即绑定

在脚本中调整图像大小

在脚本中调整图像大小

猛跑小猪 2021-12-23 19:55:48
我如何让这个脚本将图像大小调整为宽度 200 像素高度 90 像素???我已经对脚本进行了几次调整,但是当我可以将图像调整到我想要的尺寸时,图像质量很糟糕。谁能知道调整图像大小的变化?<div id="feed-list-container"></div><div style="clear:both;"></div><script type="text/javascript">var multiFeed = {    feedsUri: [        {            name: "Judul Widget 1",            url: "https://elfenliedbrazil.blogspot.com/",            tag: ""        },        {            name: "Judul Widget 2",            url: "",            tag: ""        },        {            name: "Judul Widget 1",            url: "",            tag: ""        }    ],    numPost: 10,    showThumbnail: true,    showSummary: true,    summaryLength: 80,    titleLength: "auto",    thumbSize: 200,    containerId: "feed-list-container",    readMore: {        text: "Selengkapnya",        endParam: "?max-results=20"    }};</script><script type='text/javascript'>//<![CDATA[// Multi Feed Loader Script by Taufik Nurrohman// URL: http://www.dte.web.id, https://plus.google.com/108949996304093815163/about//]]></script>
查看完整描述

1 回答

?
牛魔王的故事

TA贡献1830条经验 获得超3个赞

试试这个


<div id="feed-list-container"></div>

<div style="clear:both;"></div>

<script type="text/javascript">

var multiFeed = {

    feedsUri: [

        {

            name: "Judul Widget 1",

            url: "https://elfenliedbrazil.blogspot.com/",

            tag: ""

        },

        {

            name: "Judul Widget 2",

            url: "",

            tag: ""

        },

        {

            name: "Judul Widget 1",

            url: "",

            tag: ""

        }

    ],

    numPost: 10,

    showThumbnail: true,

    showSummary: true,

    summaryLength: 80,

    titleLength: "auto",

    thumbSize: 200,

    containerId: "feed-list-container",

    readMore: {

        text: "Selengkapnya",

        endParam: "?max-results=20"

    }

};

</script>


<script>

/*<![CDATA[*/

var mf_defaults = {

  feedsUri: [{

    name: "Posting JQuery",

    url: "http://www.dte.web.id",

    tag: "JQuery"

  }, {

    name: "Posting CSS",

    url: "http://www.dte.web.id",

    tag: "CSS"

  }, {

    name: "Widget-Widget Blogger",

    url: "http://www.dte.web.id",

    tag: "Widget"

  }],

  numPost: 4,

  showThumbnail: true,

  showSummary: true,

  summaryLength: 80,

  titleLength: "auto",

  thumbSize: 200,

  thumbWidth: 200, // new setting

  thumbHeight: 90, // new setting

  newTabLink: false,

  containerId: "feed-list-container",

  listClass: "list-entries",

  readMore: {

    text: "More",

    endParam: "?max-results=20"

  },

  autoHeight: false,

  current: 0,

  onLoadFeed: function(a) {},

  onLoadComplete: function() {},

  loadFeed: function(c) {

    var d = document.getElementsByTagName("head")[0],

      a = document.getElementById(this.containerId),

      b = document.createElement("script");

    b.type = "text/javascript";

    b.src = this.feedsUri[c].url + "/feeds/posts/summary" + (this.feedsUri[c].tag ? "/-/" + this.feedsUri[c].tag : "") + "?alt=json-in-script&max-results=" + this.numPost + "&callback=listEntries";

    d.appendChild(b)

  }

};

for(var i in mf_defaults) {

  mf_defaults[i] = (typeof(multiFeed[i]) !== undefined && typeof(multiFeed[i]) !== "undefined") ? multiFeed[i] : mf_defaults[i]

}


function listEntries(q) {

  var p = q.feed.entry,

    c = mf_defaults,

    h = document.getElementById(c.containerId),

    a = document.createElement("div"),

    d = "",

    l = c.feedsUri.length,

    n, k, m, g;

  for(var f = 0; f < c.numPost; f++) {

    if(f == p.length) {

      break

    }

    n = (c.titleLength !== "auto") ? p[f].title.$t.substring(0, c.titleLength) + (c.titleLength < p[f].title.$t.length ? "&hellip;" : "") : p[f].title.$t;

    m = ("summary" in p[f]) ? p[f].summary.$t.replace(/<br ?\/?>/g, " ").replace(/<.*?>/g, "").replace(/[<>]/g, "") : "";

    m = (c.summaryLength < m.length) ? m.substring(0, c.summaryLength) + "&hellip;" : m;

    g = ("media$thumbnail" in p[f]) ? '<img src="' + p[f].media$thumbnail.url.replace(/\/s72(\-c)?\//, "/w" + c.thumbWidth + "-h" + c.thumbHeight + "-c/") + '" style="width:' + c.thumbWidth + "px;height:" + c.thumbHeight + 'px;">' : '';

    for(var e = 0, b = p[f].link.length; e < b; e++) {

      k = (p[f].link[e].rel == "alternate") ? p[f].link[e].href : "#"

    }

    d += '<div class="post hentry"' + (!c.autoHeight ? ' style="height' + c.thumbHeight + 'px;overflow:hidden;"' : "") + ">";

    d += (c.showThumbnail) ? g : "";

    d += '<div class="post-title entry-title"><a href="' + k + '"' + (c.newTabLink ? ' target="_blank"' : "") + ">" + n + "</a></div>";

    d += '<div class="summary">';

    d += "<span" + (!c.showSummary ? ' style="display:none;"' : "") + ">";

    d += (c.showSummary) ? m : "";

    d += "</span></div>";

    d += '<span style="display:block;clear:both;"></span></div>'

  }

  d += "";

  d += '<div class="more-link"><a href="' + c.feedsUri[c.current].url.replace(/\/$/, "") + "/search/label/" + c.feedsUri[c.current].tag + c.readMore.endParam + '"' + (c.newTabLink ? ' target="_blank"' : "") + ">" + c.readMore.text + "</a></div>";

  a.className = c.listClass;

  a.innerHTML = '<div class="main-title"><h4>' + c.feedsUri[c.current].name + "</h4></div>" + d;

  h.appendChild(a);

  c.onLoadFeed(c.current);

  if((c.current + 1) < l) {

    c.loadFeed(c.current + 1)

  }

  if((c.current + 1) == l) {

    c.onLoadComplete()

  }

  c.current++

}

mf_defaults.loadFeed(0);

/*]]>*/

</script>

改变: /s"+c.thumbSize+"-c/以/w" + c.thumbWidth + "-h" + c.thumbHeight + "-c/


和其他一些c.thumbSize出现的代码


查看完整回答
反对 回复 2021-12-23
  • 1 回答
  • 0 关注
  • 146 浏览
慕课专栏
更多

添加回答

举报

0/150
提交
取消
意见反馈 帮助中心 APP下载
官方微信