Tumblr Photoset最大宽度

时间:2012-02-24 06:12:10

标签: width block photo tumblr

Tumblr将照片限制为500px。 我想发布大于此宽度的照​​片集。如果我将500更改为其他内容,则不会显示帖子。有没有办法在tumblr上发布更大宽度的照片?

   {block:Photoset}             

<p class="object">{Photoset-500}</p>
{block:Caption}<div class="caption">{Caption}</div>{/block:Caption}

            {/block:Photoset}

1 个答案:

答案 0 :(得分:2)

忽略我之前的回答。这是你需要做的。在{block:Photoset}内,使用以下内容显示大照片。

{block:Photos}
<img src="{PhotoURL-250}" class="photoset-image" />
{/block:Photos}
<script type="text/javascript">
var photos = document.getElementsByClassName("photoset-image");
for(var i = 0; i < photos.length; i++)
{
    photos[i].style.width = '1280px'; // you can put whatever width you want here
    var source = photos[i].src;
    var pos1 = source.lastIndexOf('_');
    var pos2 = source.lastIndexOf('.');
    photos[i].src = source.substring(0, pos1 + 1) + '1280' + source.substring(pos2); // has to be 1280
}
</script>

所有这一切都是采用提供的URL并将其替换为1280。注意:如果高分辨率版本不存在,这将不起作用。所以,你可能想以编程方式处理它。