admin

阿里云图片如何加水印图
参考阿里云oss官方地址:https://helpcdn.aliyun.com/document_detail/4...
扫描右侧二维码阅读全文
22
2020/10

阿里云图片如何加水印图

参考

阿里云oss官方地址:https://helpcdn.aliyun.com/document_detail/44957.html?spm=a2c4g.11186623.4.4.cd4b35a8uhEMdn#h2-url-2

Base64转换地址: https://www.sojson.com/base64.html

js-base64库地址: https://www.npmjs.com/package/js-base64

注意

微信截图_20201022175302.png

水印图最好放在oss的根目录,否则可能会报错:

NoSuchKey The specified key does not exist. 5F914DB1562DF43939EABB81 

字符串转base64

import { Base64 } from 'js-base64'

const imageBase64 = Base64.toBase64(
    'panda.png?x-oss-process=image/resize,P_30'
)

添加水印

  • 将主图example.jpg缩略为宽高300:resize,w_300,h_300
  • 将主图图片质量设为90%:quality,q_90
  • 添加水印图片panda.png:watermark,image_cGFuZGEucG5n(cGFuZGEucG5n是panda.png进行Base64编码后的值)
Last modification:October 22nd, 2020 at 05:57 pm

Leave a Comment