以 Blob 数据类型检索图像表单数据库

问题描述 投票:0回答:0

任何人都可以帮助我并告诉我我是什么 我在这里做错了,我似乎无法弄清楚为什么我不能在 html 页面上获得签名 这是我正在使用的代码....

<?php
include('config.php');


$sql = "SELECT signature FROM details WHERE id = ?";
$stmt = $pdo->prepare($sql);

$id = "116"; // Replace with the ID of the signature data to retrieve
$stmt->bindParam(1, $id, PDO::PARAM_INT);

$stmt->execute();

// Fetch the result and return the base64-encoded signature data
$result = $stmt->fetch(PDO::FETCH_ASSOC);
if ($result) {
    $signatureData = $result['signature'];
    $base64Data = base64_encode($signatureData);
    $img = '<img src="data:image/png;base64,'>';
    echo $img;

  } else {
    echo "No signature data found for ID $id";
  }
  ?>

我正在尝试在数据库中的 html 表单上显示签名

php base64 blob signature
最新问题
© www.soinside.com 2019 - 2024. All rights reserved.