我想在HTML5畫布上顯示AppEngine blobstore PNG圖像。這是我到目前爲止已經試過,基於HTML5教程和使用Web應用程序模板,通過PNG圖像和它的尺寸到客戶端:如何在HTML5畫布上呈現AppEngine blobstore圖像?
<html>
<head>
<script type="text/javascript">
function draw(png) {
var ctx = document.getElementById('image').getContext('2d');
var img = new Image();
img.onload = function(){
ctx.drawImage(img,0,0)
};
img.src = png;
}
</script>
</head>
<body onload="draw({{png}});">
<canvas id="image" width={{width}} height={{height}}></canvas>
</body>
</html>
聲明
img.src = PNG
我想是錯誤的,因爲JavaScript Image對象的SRC屬性必須是服務器端文件名。但App Engine上沒有服務器端文件,那麼有沒有辦法做到這一點?
由於
莫特
非常感謝,尼克。我應該知道,因爲我正在使用blob服務器處理程序已經將斑點傳遞給Picloud。 – MortCanty 2012-04-02 14:02:04