封面/截图文本对接教程

开启图片转换文本后,EFV生成的封面、截图链接无法正常显示,且会生成对应的txt文本链接,需前端解密调用。

对接之前请先了解下封面截图转文本的原理及设置 ⇒ 传送门,这里只提供一个前端html使用示例,然后自行对接。

HTML示例

<!DOCTYPE html>
<html lang="zh-CN">
<head>
<meta charset="UTF-8">
<title>EFV文本图片展示</title>
</head>
<body>
<img id="base64Image" src="" alt="从链接解密Base64后的图片将显示在这里">

<script>
let base64TextUrl = "https://demo.zhuanma.co/videos/202403/14/65f2f08685a309da271d0dec/cover.txt";

// 使用fetch API从链接获取Base64文本
fetch(base64TextUrl)
.then(response => response.text()) // 获取文本内容
.then(base64Text => {
    let imageDataUrl = "data:image/png;base64," + base64Text;
    // 设置图片的src属性为DataURL
    document.getElementById('base64Image').src = imageDataUrl;
})
.catch(error => console.error('获取Base64文本失败:', error));
</script>
</body>
</html>