1

我无法将 SignaturePad 图像正确保存到我的服务器。uri 正确地从 Javascript 传递到 PHP,因为我可以在 html 中单独呈现 uri。但是,当我尝试将其导出为 png 文件时,无法显示该图像。我在下面发布了一个示例 uri。如果将其粘贴到浏览器中,它将正确呈现。但是,它不会正确保存为 png 文件。它是黑色的,不应该是。我尝试从其他来源(不是 SignaturePad)导出各种其他 uri,它们将正确保存为 png。此外,签名板中的背景设置为白色,因此这不应该是问题。

Uri does not render correctly as png: data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAABFEAAAGQCAYAAABmlf8RAAAgAElEQVR4Xu3dT6hed1oH8EwbpUEwQWcxQWaSIREqyjTZSBYJ7cbNDEiKYsauhGTcCUkRTBdVlELqxgR3MslCkGm7kHQWzkZh2mmgFJHEheNiEtpUcAoqk4q0wWmszzuei6dvb29+9973z/ec8xk4vO977++c8zyf58dl+iXv+35uj/8RIECAAAECBAgQIECAAAECBAg8VOBzD11hAQECBAgQIECAAAECBAgQIECAwB4hik1AgAABAgQIECBAgAABAgQIEGgQEKI0IFlCgAABAgQIECBAgAABAgQIEBCi2AMECBAgQIAAAQIECBAgQIAAgQYBIUoDkiUECBAgQIAAAQIECBAgQIAAASGKPUCAAAECBAgQIECAAAECBAgQaBAQojQgWUKAAAECBAgQIECAAAECBAgQEKLYAwQIECBAgAABAgQIECBAgACBBgEhSgOSJQQIECBAgAABAgQIECBAgAABIYo9QIAAAQIECBAgQIAAAQIECBBoEBCiNCBZQoAAAQIECBAgQIAAAQIECBAQotgDBAgQIECAAAECBAgQIECAAIEGASFKA5IlBAgQIECAAAECBAgQIECAAAEhij1AgAABAgQIECBAgAABAgQIEGgQEKI0IFlCgAABAgQIECBAgAABAgQIEBCi2AMECBAgQIAAAQIECBAgQIAAgQYBIUoDkiUECBAgQIAAAQIECBAgQIAAASGKPUCAAAECBAgQIECAAAECBAgQaBAQojQgWUKAAAECBAgQIECAAAECBAgQEKLYAwQIECBAgAABAgQIECBAgACBBgEhSgOSJQQIECBAgAABAgQIECBAgAABIYo9QIAAAQIECBAgQIAAAQIECBBoEBCiNCBZQoAAAQIECBAgQIAAAQIECBAQotgDBAgQIECAAAECBAgQIECAAIEGASFKA5IlBAgQIECAAAECBAgQIECAAAEhij1AgAABAgQIECBAgAABAgQIEGgQEKI0IFlCgAABAgQIECBAgAABAgQIEBCi2AMECBAgQIAAAQIECBAgQIAAgQYBIUoDkiUECBAgQIAAAQIECBAgQIAAASGKPUCAAAECBAgQIECAAAECBAgQaBAQojQgWUKAAAECBAgQIECAAAECBAgQEKLYAwQIECBAgAABAgQIECBAgACBBgEhSgOSJQQIECBAgAABAgQIECBAgAABIYo9QIAAAQIECBAgQIAAAQIECBBoEBCiNCBZQoAAAQIECBAgQIAAAQIECBAQotgDBAgQIECAAAECBAgQIECAAIEGASFKA5IlBAgQIECAAAECBAgQIECAAAEhij1AgAABAgQIECBAgAABAgQIEGgQEKI0IFlCgAABAgQIECBAgAABAgQIEBCi2AMECBAgQIAAAQIECBAgQIAAgQYBIUoDkiUECBAgQIAAAQIECBAgQIAAASGKPUCAAAECBAgQIECAAAECBAgQaBAQojQgWUKAAAECBAgQIECAAAECBAgQEKLYAwQIECBAgAABAgQIECBAgACBBgEhSgOSJQQIECBAgAABAgQIECBAgAABIYo9QIAAAQIECBAgQIAAAQIECBBoEBCiNCBZQoAAAQIECBAgQIAAAQIECBAQotgDBAgQIECAAAECBAgQIECAAIEGASFKA5IlBAgQIECAAAECBAgQIECAAAEhij1AgAABAgQIECBAgAABAgQIEGgQEKI0IFlCgAABAgQIECBAgAABAgQIEBCi2AMECBAgQIAAAQIECBAgQIAAgQYBIUoDkiUECBAgQIAAAQIECBAgQIAAASGKPUCAAAECBAgQIECAAAECBAgQaBAQojQgWUKAAAECBAgQIECAAAECBAgQEKLYAwQIECBAgAABAgQIECBAgACBBgEhSgOSJQQIECBAgAABAgQIECBAgAABIYo9QIAAAQIECBAgQIAAAQIECBBoEBCiNCBZQoAAAQIECBAgQIAAAQIECBAQotgDBAgQIECAAAECBAgQIECAAIEGASFKA5IlBAgQIECAAAECBAgQIECAAAEhij1AgAABAgQIECBAgAABAgQIEGgQEKI0IFlCgAABAgQIECBAgAABAgQIEBCi2AMECBAgQIAAAQIECBAgQIAAgQYBIUoDkiUECBAgQIAAAQIECBAgQIAAASGKPUCAAAECBAgQIECAAAECBAgQaBAQojQgWUKAAAECBAgQIECAAAECBAgQEKLYAwQIECBAgAABAgQIECBAgACBBgEhSgOSJQQIECBAgAABAgQIECBAgAABIYo9QIAAAQIECBAgQIAAAQIECBBoEBCiNCBZQoAAAQIECBAgQIAAAQIECBAQotgDBAgQIECAAAECBAgQIECAAIEGASFKA5IlBAgQIECAAAECBAgQIECAAAEhij1AgAABAgQIECBAgAABAgQIEGgQEKI0IFlCgAABAgQIECBAgAABAgQIEBCi2AMECBAgQIAAAQIECBAgQIAAgQYBIUoDkiUECBAgQIAAAQIECBAgQIAAASGKPUCAAAECBAgQIECAAAECBAgQaBAQojQgWUKAAAECBAgQIECAAAECBAgQEKLYAwQIECBAgAABAgQIECBAgACBBgEhSgOSJQQIECBAgAABAgQIECBAgAABIYo9QIAAAQIECBAgQIAAAQIECBBoEBCiNCBZQoAAAQIECBAgQIAAAQIECBAQotgDBAgQIECAAAECBAgQIECAAIEGASFKA5IlBAgQIECAAAECBAgQIECAAAEhij1AgAABAgQIECBAgAABAgQIEGgQEKI0IFlCgAABAgQIECBAgAABAgQIEBCi2AMECBAgQIAAAQIECBAgQIAAgQYBIUoDkiUECBAgQIAAAQIECBAgQIAAASGKPUCAAAECBAgQIECAAAECBAgQaBAQojQgWUKAAAECBAgQIECAAAECBAgQEKLYAwQIECBAgAABAgQIECBAgACBBgEhSgOSJQQIECBAgAABAgQIECBAgAABIYo9QIAAAQIECBAgQIAAAQIECBBoEBCiNCBZQoAAAQIECBAgQIAAAQIECBAQotgDBAgQIECAAAECBAgQIECAAIEGASFKA5IlBAgQIECAAAECBAgQIECAAAEhij1AgAABAgQIECBAgAABAgQIEGgQEKI0I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uHqJECAAAECBAgQIEBgvAJClPHOVmcEhipwsgp/o1f8tXp+bqjNqJsAAQIECBAgQIAAgfEICFHGM0udEBiLwNVq5GyvmQv1/MpYmtMHAQIECBAgQIAAAQLDFRCiDHd2KicwVoHXqrEne835OzXWSeuLAAECBAgQIECAwMAE/MfJwAamXAITELhXPe7v+ny/Hg9MoGctEiBAgAABAgQIECAwAAEhygCGpEQCExO4Xv2e7nq+VY/HJ9a/dgkQIECAAAECBAgQCBUQooQORlkEJi4w+3DZX6jjlYk7aJ8AAQIECBAgQIAAgSABIUrQMJRCgAABAgQIECBAgAABAgQI5AoIUXJnozICBAgQIECAAAECBAgQIEAgSECIEjQMpRAgQIAAAQIECBAgQIAAAQK5AkKU3NmojAABAgQIECBAgAABAgQIEAgSEKIEDUMpBAgQIECAAAECBAgQIECAQK6AECV3NiojQIAAAQIECBAgQIAAAQIEggSEKEHDUAoBAgQIECBAgAABAgQIECCQKyBEyZ2NyggQIECAAAECBAgQIECAAIEgASFK0DCUQoAAAQIECBAgQIAAAQIECOQKCFFyZ6MyAgQIECBAgAABAgQIECBAIEhAiBI0DKUQIECAAAECBAgQIECAAAECuQJClNzZqIwAAQIECBAgQIAAAQIECBAIEhCiBA1DKQQIECBAgAABAgQIECBAgECugBAldzYqI0CAAAECBAgQIECAAAECBIIEhChBw1AKAQIECBAgQIAAAQIECBAgkCsgRMmdjcoIECBAgAABAgQIECBAgACBIAEhStAwlEKAAAECBAgQIECAAAECBAjkCghRcmejMgIECBAgQIAAAQIECBAgQCBIQIgSNAylECBAgAABAgQIECBAgAABArkCQpTc2aiMAAECBAgQIECAAAECBAgQCBIQogQNQykECBAgQIAAAQIECBAgQIBAroAQJXc2KiNAgAABAgQIECBAgAABAgSCBIQoQcNQCgECBAgQIECAAAECBAgQIJArIETJnY3KCBAgQIAAAQIECBAgQIAAgSABIUrQMJRCgAABAgQIECBAgAABAgQI5AoIUXJnozICBAgQIECAAAECBAgQIEAgSECIEjQMpRAgQIAAAQIECBAgQIAAAQK5AkKU3NmojAABAgQIECBAgAABAgQIEAgSEGrhp6QAAAueSURBVKIEDUMpBAgQIECAAAECBAgQIECAQK6AECV3NiojQIAAAQIECBAgQIAAAQIEggSEKEHDUAoBAgQIECBAgAABAgQIECCQKyBEyZ2NyggQIECAAAECBAgQIECAAIEgASFK0DCUQoAAAQIECBAgQIAAAQIECOQKCFFyZ6MyAgQIECBAgAABAgQIECBAIEhAiBI0DKUQIECAAAECBAgQIECAAAECuQJClNzZqIwAAQIECBAgQIAAAQIECBAIEhCiBA1DKQQIECBAgAABAgQIECBAgECugBAldzYqI0CAAAECBAgQIECAAAECBIIEhChBw1AKAQIECBAgQIAAAQIECBAgkCsgRMmdjcoIECBAgAABAgQIECBAgACBIAEhStAwlEKAAAECBAgQIECAAAECBAjkCghRcmejMgIECBAgQIAAAQIECBAgQCBIQIgSNAylECBAgAABAgQIECBAgAABArkCQpTc2aiMAAECBAgQIECAAAECBAgQCBIQogQNQykECBAgQIAAAQIECBAgQIBAroAQJXc2KiNAgAABAgQIECBAgAABAgSCBIQoQcNQCgECBAgQIECAAAECBAgQIJArIETJnY3KCBAgQIAAAQIECBAgQIAAgSABIUrQMJRCgAABAgQIECBAgAABAgQI5AoIUXJnozICBAgQIECAAAECBAgQIEAgSECIEjQMpRAgQIAAAQIECBAgQIAAAQK5AkKU3NmojAABAgQIECBAgAABAgQIEAgSEKIEDUMpBAgQIECAAAECBAgQIECAQK6AECV3NiojQIAAAQIECBAgQIAAAQIEggSEKEHDUAoBAgQIECBAgAABAgQIECCQKyBEyZ2NyggQIECAAAECBAgQIECAAIEgASFK0DCUQoAAAQIECBAgQIAAAQIECOQKCFFyZ6MyAgQIECBAgAABAgQIECBAIEhAiBI0DKUQIECAAAECBAgQIECAAAECuQJClNzZqIwAAQIECBAgQIAAAQIECBAIEhCiBA1DKQQIECBAgAABAgQIECBAgECugBAldzYqI0CAAAECBAgQIECAAAECBIIEhChBw1AKAQIECBAgQIAAAQIECBAgkCsgRMmdjcoIECBAgAABAgQIECBAgACBIAEhStAwlEKAAAECBAgQIECAAAECBAjkCghRcmejMgIECBAgQIAAAQIECBAgQCBIQIgSNAylECBAgAABAgQIECBAgAABArkCQpTc2aiMAAECBAgQIECAAAECBAgQCBIQogQNQykECBAgQIAAAQIECBAgQIBAroAQJXc2KiNAgAABAgQIECBAgAABAgSCBIQoQcNQCgECBAgQIECAAAECBAgQIJArIETJnY3KCBAgQIAAAQIECBAgQIAAgSABIUrQMJRCgAABAgQIECBAgAABAgQI5AoIUXJnozICBAgQIECAAAECBAgQIEAgSECIEjQMpRAgQIAAAQIECBAgQIAAAQK5AkKU3NmojAABAgQIECBAgAABAgQIEAgSEKIEDUMpBAgQIECAAAECBAgQIECAQK6AECV3NiojQIAAAQIECBAgQIAAAQIEggSEKEHDUAoBAgQIECBAgAABAgQIECCQKyBEyZ2NyggQIECAAAECBAgQIECAAIEgASFK0DCUQoAAAQIECBAgQIAAAQIECOQKCFFyZ6MyAgQIECBAgAABAgQIECBAIEhAiBI0DKUQIECAAAECBAgQIECAAAECuQJClNzZqIwAAQIECBAgQIAAAQIECBAIEhCiBA1DKQQIECBAgAABAgQIECBAgECugBAldzYqI0CAAAECBAgQIECAAAECBIIEhChBw1AKAQIECBAgQIAAAQIECBAgkCsgRMmdjcoIECBAgAABAgQIECBAgACBIAEhStAwlEKAAAECBAgQIECAAAECBAjkCghRcmejMgIECBAgQIAAAQIECBAgQCBIQIgSNAylECBAgAABAgQIECBAgAABArkCQpTc2aiMAAECBAgQIECAAAECBAgQCBIQogQNQykECBAgQIAAAQIECBAgQIBAroAQJXc2KiNAgAABAgQIECBAgAABAgSCBIQoQcNQCgECBAgQIECAAAECBAgQIJArIETJnY3KCBAgQIAAAQIECBAgQIAAgSABIUrQMJRCgAABAgQIECBAgAABAgQI5AoIUXJnozICBAgQIECAAAECBAgQIEAgSECIEjQMpRAgQIAAAQIECBAgQIAAAQK5AkKU3NmojAABAgQIECBAgAABAgQIEAgSEKIEDUMpBAgQIECAAAECBAgQIECAQK6AECV3NiojQIAAAQIECBAgQIAAAQIEggSEKEHDUAoBAgQIECBAgAABAgQIECCQKyBEyZ2NyggQIECAAAECBAgQIECAAIEgASFK0DCUQoAAAQIECBAgQIAAAQIECOQKCFFyZ6MyAgQIECBAgAABAgQIECBAIEhAiBI0DKUQIECAAAECBAgQIECAAAECuQJClNzZqIwAAQIECBAgQIAAAQIECBAIEhCiBA1DKQQIECBAgAABAgQIECBAgECugBAldzYqI0CAAAECBAgQIECAAAECBIIEhChBw1AKAQIECBAgQIAAAQIECBAgkCsgRMmdjcoIECBAgAABAgQIECBAgACBIAEhStAwlEKAAAECBAgQIECAAAECBAjkCghRcmejMgIECBAgQIAAAQIECBAgQCBIQIgSNAylECBAgAABAgQIECBAgAABArkCQpTc2aiMAAECBAgQIECAAAECBAgQCBIQogQNQykECBAgQIAAAQIECBAgQIBAroAQJXc2KiNAgAABAgQIECBAgAABAgSCBIQoQcNQCgECBAgQIECAAAECBAgQIJArIETJnY3KCBAgQIAAAQIECBAgQIAAgSABIUrQMJRCgAABAgQIECBAgAABAgQI5AoIUXJnozICBAgQIECAAAECBAgQIEAgSECIEjQMpRAgQIAAAQIECBAgQIAAAQK5AkKU3NmojAABAgQIECBAgAABAgQIEAgSEKIEDUMpBAgQIECAAAECBAgQIECAQK6AECV3NiojQIAAAQIECBAgQIAAAQIEggSEKEHDUAoBAgQIECBAgAABAgQIECCQKyBEyZ2NyggQIECAAAECBAgQIECAAIEgASFK0DCUQoAAAQIECBAgQIAAAQIECOQKCFFyZ6MyAgQIECBAgAABAgQIECBAIEhAiBI0DKUQIECAAAECBAgQIECAAAECuQJClNzZqIwAAQIECBAgQIAAAQIECBAIEhCiBA1DKQQIECBAgAABAgQIECBAgECugBAldzYqI0CAAAECBAgQIECAAAECBIIEhChBw1AKAQIECBAgQIAAAQIECBAgkCsgRMmdjcoIECBAgAABAgQIECBAgACBIAEhStAwlEKAAAECBAgQIECAAAECBAjkCghRcmejMgIECBAgQIAAAQIECBAgQCBIQIgSNAylECBAgAABAgQIECBAgAABArkCQpTc2aiMAAECBAgQIECAAAECBAgQCBIQogQNQykECBAgQIAAAQIECBAgQIBAroAQJXc2KiNAgAABAgQIECBAgAABAgSCBIQoQcNQCgECBAgQIECAAAECBAgQIJArIETJnY3KCBAgQIAAAQIECBAgQIAAgSABIUrQMJRCgAABAgQIECBAgAABAgQI5AoIUXJnozICBAgQIECAAAECBAgQIEAgSECIEjQMpRAgQIAAAQIECBAgQIAAAQK5AkKU3NmojAABAgQIECBAgAABAgQIEAgSEKIEDUMpBAgQIECAAAECBAgQIECAQK6AECV3NiojQIAAAQIECBAgQIAAAQIEggSEKEHDUAoBAgQIECBAgAABAgQIECCQKyBEyZ2NyggQIECAAAECBAgQIECAAIEgASFK0DCUQoAAAQIECBAgQIAAAQIECOQKCFFyZ6MyAgQIECBAgAABAgQIECBAIEhAiBI0DKUQIECAAAECBAgQIECAAAECuQL/Czi8D6CSuaJJAAAAAElFTkSuQmCC

PHP 代码

$data_uri=$data['image'];//Replace this with the uri's above for testing.
$encoded_image = explode(",", $data_uri)[1];
$encoded_image= str_replace(' ','+',$encoded_image);
$decoded_image = base64_decode($encoded_image);

/*Save the signature image to a file*/
$fileType='png';
$uploadDir = getcwd() . '/uploads/';
$uniqueIDX=uniqid();
$fileName= $uniqueIDX . '.png';
$fileDirectory = $uploadDir . $fileName;
file_put_contents($fileDirectory, $decoded_image);

任何帮助将非常感激。如果您需要更多信息,请与我们联系。

4

2 回答 2

0

谢谢!即使我之前设置了背景,我也有一个从图像中删除背景的调整大小事件。现在一切就绪。

于 2016-10-14T01:45:29.447 回答
0

PNG 文件包含透明背景。您可以通过在具有黑色背景的 html 文件中使用数据 uri 来测试它。这也是 png(从 Firefox 保存)在paint.net 中的样子。它有一个透明的背景:在此处输入图像描述

向我们展示您用于在您的网站中建立签名板并获取图像的代码。您需要确保将backgroundColorSignaturePad 的参数指定为非透明颜色。

var signaturePad = new SignaturePad(c, {
    backgroundColor: "white",
    minWidth: 5,
    maxWidth: 10,
    penColor: "black"
});
于 2016-10-09T12:18:27.130 回答