dqg95034 2019-04-15 06:46
浏览 483

如何将base64转换为图像(画布)并使用php将其保存到文件夹路径?

I am confused as how to upload that base64 to folder path. Here is my code:

var img = document.createElement('img') || document.querySelector('img');
var context;
var width = video.offsetWidth
        , height = video.offsetHeight;

canvas = canvas || document.createElement('canvas');
canvas.width = width;
canvas.height = height;

context = canvas.getContext('2d');
context.drawImage(video, 0, 0, width, height);

img.src = canvas.toDataURL('image/png');
document.body.appendChild(img);
  • 写回答

2条回答 默认 最新

  • drc4925 2019-04-15 07:30
    关注

    In my code, I used this and it worked:

    $picture = rtrim(strtr(base64_encode($_FILES['userfile']['name']), '+/', '-_'), '=');

    For the view:

    img src=" echo base_url(). 'admin/assets/uploads/product/'.$product['userfile'];" alt="img" class = "img-thumbnail rounded float-left image-product"

    评论

报告相同问题?

悬赏问题

  • ¥20 腾讯企业邮箱邮件可以恢复么
  • ¥15 有人知道怎么将自己的迁移策略布到edgecloudsim上使用吗?
  • ¥15 错误 LNK2001 无法解析的外部符号
  • ¥50 安装pyaudiokits失败
  • ¥15 计组这些题应该咋做呀
  • ¥60 更换迈创SOL6M4AE卡的时候,驱动要重新装才能使用,怎么解决?
  • ¥15 让node服务器有自动加载文件的功能
  • ¥15 jmeter脚本回放有的是对的有的是错的
  • ¥15 r语言蛋白组学相关问题
  • ¥15 Python时间序列如何拟合疏系数模型