开发者

uploading an <img> to a remote server

What I am able to do right now is to get the content of a canvas and convert it to a png using img.src = toDataUrl().

What I would like to do now is to upload that img on a remote ser开发者_高级运维ver using PHP. Is there a way that this can be done?


Take a look at how it's done here (the second post). You need to have the cURL PHP extension installed on your web server.


Send the result of canvas.toDataURL()

var imageInfo = canvas.toDataURL(); /* sample: data:image/png;base64,iVBORw0KGgo..." */

Direct way to create the png file:

<?php
$image = fopen($imageInfo, 'r');
file_put_contents("fileName.png", $image);
fclose($image);
?>
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜