【发布时间】:2013-08-16 08:05:30
【问题描述】:
我正在使用 canvas 并使用以下脚本创建图像,
function getImage() {
var canvas1 = document.getElementById("images");
if (canvas1.getContext) {
var ctx = canvas1.getContext("2d");
var myImage = canvas1.toDataURL("image/jpg");
}
$('<form action="download.php" method="POST">' +
'<input type="hidden" name="aid" value="' + myImage + '">' +
'</form>').submit();
}
在我的 Download.php 文件中,
<?php $img = $_POST['aid'];
echo "<img src=".$img.">";
?>
它正确显示图像。但我想给下载按钮以 jpg 格式或 pdf 格式。
如何使用?
我使用了 base64_decode(); 方法。但是我解决不了。
帮帮我...
【问题讨论】:
标签: php image html5-canvas base64 data-url