如何将PNG图像显示到图像

时间:2014-11-26 11:13:50

标签: javascript php html5-canvas base64

我正在使用" Canvas2Image"用于将画布图形转换为PNG图像的JavaScript工具。我现在需要的是将这些PNG格式转换为精确图像..如何在转换PNG后转换为我的代码在PHP中显示PNG ..

onrendered: function (canvas) {
                 theCanvas = canvas;
                 var a = Canvas2Image.saveAsPNG(canvas, true);
                 //Canvas2Image.saveAsPNG(canvas);
                 var data = new FormData();
                 data.append("_imgCalendar", a.src);
                 data.append("TXNID", '<?php echo $this->request->data['Plotting']['ID']; ?>');                 
                 var ajaxRequest = $.ajax({
                     type: "POST",
                     url: url,
                     contentType: false,
                     processData: false,
                     data: data,
                     success: function (data) {      
                     location.href = "<?php echo $this->Html->url(array('plugin'=>'hrms','controller'=>'Plottings/SaveCalendar')); ?>";
                     }
                 });
             }

我试图转换成精确的图像..

echo '<img src="data:image/jpeg;base64,' . base64_encode($this->request->data['_imgCalendar']) . '" />';

所以请建议mi适当的答案。

0 个答案:

没有答案