我正在使用html2canvas努力获取网页的屏幕截图并将其呈现为缩略图(以及400x300,不完全是缩略图)。Html2Canvas调整大小
如何将图像大小设置为400x300?在萤火虫我找到属性为:。但是,我无法弄清楚我的代码(下面)或html2canvas.js在哪里硬编码400x300参数。
screenshot.html:
Screenshotvar date=new Date();
var message,timeoutTimer,timer;
var proxyUrl="http://html2canvas.appspot.com";
function addRow(a,c,d){var b=$("
").appendTo($(a));b.append($("").css("font-weight","bold").text(c)).append($("").text(d))}function throwMessage(b,a){window.clearTimeout(timeoutTimer);timeoutTimer=window.setTimeout(function(){message.fadeOut(function(){message.remove()})},a||2000);$(message).remove();message=$("").attr("src","loading.gif").css("margin-top",40));var f=document.createElement("a");f.href=c;$.ajax({data:{xhr2:false,url:f.href},url:proxyUrl,dataType:"jsonp",success:function(e){a=document.createElement("iframe");$(a).css({visibility:"hidden"}).width($(window).width()/2).height($(window).height()/2);$("#content").append(a);b=a.contentWindow.document;b.open();$(a.contentWindow).load(function(){var g=$(a).contents().find("body"),h={onrendered:function(j){$("#content").empty().append(j);$("#getscreenshot").prop("disabled",false);$("base").attr("href","")},allowTaint:true,taintTest:false,flashcanvas:"src/flashcanvas.min.js"},i=html2canvas(g,h)});$("base").attr("href",f.protocol+"//"+f.hostname+"/"+f.pathname);e=e.replace("","");if($("#disablejs").prop("checked")){e=e.replace(/\Website URL:
Get screenshot!
2012-07-09
Chris