【钉钉小程序拍照+水印+保存本地+上传服务器】

本文介绍如何在钉钉小程序中实现拍照功能,并添加自定义水印,随后将图片保存到本地及上传至服务器的完整流程。
摘要由CSDN通过智能技术生成

钉钉小程序拍照+水印+保存本地+上传服务器

axml
<canvas style="position:fixed;top:100vh;left:100vw; width:{
  {imgWidth}};height:{
  {imgHeight}};"  canvas-id="myCanvas" id="myCanvas" class="myCanvas"></canvas>
绝对定位 目的不影响页面美观
JS
// 拍照
dd.chooseImage({
      sourceType: ['camera'],
      success: (res) => {
        const filePath = res.filePaths[0];
        // 获取图片信息 宽高
        dd.getImageInfo({
          src: filePath,
          success(res) {
            dd.showLoading({content:'图片处理中...'});
            const imgWidth = res.width;
            const imgHeight = res.height;
            that.setData({imgWidth,imgHeight});
            ctx.drawImage(filePath, 0, 0, imgWidth, imgHeight);
            ctx.setFontSize(50);
            ctx.setFillStyle('red');
            ctx.setTextAlign('left');
            ctx.fillText('站址名称:&
评论 3
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值