2016-10-08 78 views
1

我無法正確地將SignaturePad圖像保存到我的服務器。 uri正確地從Javascript傳遞給PHP,因爲我可以在html中自己渲染uri。但是,當我嘗試將它導出爲png文件時,我無法看到圖像。我已經在下面發佈了一個示例uri。如果您將其粘貼到瀏覽器中,它將正確呈現。但是,它不能正確保存爲png文件。它是黑色的,不應該是。我試圖從其他來源(不是SignaturePad)導出各種其他uri,並且它們將正確保存到png。另外,signaturepad中的背景設置爲白色,所以不應該是問題。從SignaturePad導出圖像,但沒有透明背景

Uri does not render correctly as png: data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAABFEAAAGQCAYAAABmlf8RAAAgAElEQVR4Xu3dT6hed1oH8EwbpUEwQWcxQWaSIREqyjTZSBYJ7cbNDEiKYsauhGTcCUkRTBdVlELqxgR3MslCkGm7kHQWzkZh2mmgFJHEheNiEtpUcAoqk4q0wWmszzuei6dvb29+9973z/ec8xk4vO977++c8zyf58dl+iXv+35uj/8RIECAAAECBAgQIECAAAECBAg8VOBzD11hAQECBAgQIECAAAECBAgQIECAwB4hik1AgAABAgQIECBAgAABAgQIEGgQEKI0IFlCgAABAgQIECBAgAABAgQIEBCi2AMECBAgQIAAAQIECBAgQIAAgQYBIUoDkiUECBAgQIAAAQIECBAgQIAAASGKPUCAAAECBAgQIECAAAECBAgQaBAQojQgWUKAAAECBAgQIECAAAECBAgQEKLYAwQIECBAgAABAgQIECBAgACBBgEhSgOSJQQIECBAgAABAgQIECBAgAABIYo9QIAAAQIECBAgQIAAAQIECBBoEBCiNCBZQoAAAQIECBAgQIAAAQIECBAQotgDBAgQIECAAAECBAgQIECAAIEGASFKA5IlBAgQIECAAAECBAgQIECAAAEhij1AgAABAgQIECBAgAABAgQIEGgQEKI0IFlCgAABAgQIECBAgAABAgQIEBCi2AMECBAgQIAAAQIECBAgQIAAgQYBIUoDkiUECBAgQIAAAQIECBAgQIAAASGKPUCAAAECBAgQIECAAAECBAgQaBAQojQgWUKAAAECBAgQIECAAAECBAgQEKLYAwQIECBAgAABAgQIECBAgACBBgEhSgOSJQQIECBAgAABAgQIECBAgAABIYo9QIAAAQIECBAgQIAAAQIECBBoEBCiNCBZQoAAAQIECBAgQIAAAQIECBAQotgDBAgQIECAAAECBAgQIECAAIEGASFKA5IlBAgQIECAAAECBAgQIECAAAEhij1AgAABAgQIECBAgAABAgQIEGgQEKI0IFlCgAABAgQIECBAgAABAgQIEBCi2AMECBAgQIAAAQIECBAgQIAAgQYBIUoDkiUECBAgQIAAAQIECBAgQIAAASGKPUCAAAECBAgQIECAAAECBAgQaBAQojQgWUKAAAECBAgQIECAAAECBAgQEKLYAwQIECBAgAABAgQIECBAgACBBgEhSgOSJQQIECBAgAABAgQIECBAgAABIYo9QIAAAQIECBAgQIAAAQIECBBoEBCiNCBZQoAAAQIECBAgQIAAAQIECBAQotgDBAgQIECAAAECBAgQIECAAIEGASFKA5IlBAgQIECAAAECBAgQIECAAAEhij1AgAABAgQIECBAgAABAgQIEGgQEKI0IFlCgAABAgQIECBAgAABAgQIEBCi2AMECBAgQIAAAQIECBAgQIAAgQYBIUoDkiUECBAgQIAAAQIECBAgQIAAASGKPUCAAAECBAgQIECAAAECBAgQaBAQojQgWUKAAAECBAgQIECAAAECBAgQEKLYAwQIECBAgAABAgQIECBAgACBBgEhSgOSJQQIECBAgAABAgQIECBAgAABIYo9QIAAAQIECBAgQIAAAQIECBBoEBCiNCBZQoAAAQIECBAgQIAAAQIECBAQotgDBAgQIECAAAECBAgQIECAAIEGASFKA5IlBAgQIECAAAECBAgQIECAAAEhij1AgAABAgQIECBAgAABAgQIEGgQEKI0IFlCgAABAgQIECBAgAABAgQIEBCi2AMECBAgQIAAAQIECBAgQIAAgQYBIUoDkiUECBAgQIAAAQIECBAgQIAAASGKPUCAAAECBAgQIECAAAECBAgQaBAQojQgWUKAAAECBAgQIECAAAECBAgQEKLYAwQIECBAgAABAgQIECBAgACBBgEhSgOSJQQIECBAgAABAgQIECBAgAABIYo9QIAAAQIECBAgQIAAAQIECBBoEBCiNCBZQoAAAQIECBAgQIAAAQIECBAQotgDBAgQIECAAAECBAgQIECAAIEGASFKA5IlBAgQIECAAAECBAgQIECAAAEhij1AgAABAgQIECBAgAABAgQIEGgQEKI0IFlCgAABAgQIECBAgAABAgQIEBCi2AMECBAgQIAAAQIECBAgQIAAgQYBIUoDkiUECBAgQIAAAQIECBAgQIAAASGKPUCAAAECBAgQIECAAAECBAgQaBAQojQgWUKAAAECBAgQIECAAAECBAgQEKLYAwQIECBAgAABAgQIECBAgACBBgEhSgOSJQQIECBAgAABAgQIECBAgAABIYo9QIAAAQIECBAgQIAAAQIECBBoEBCiNCBZQoAAAQIECBAgQIAAAQIECBAQotgDBAgQIECAAAECBAgQIECAAIEGASFKA5IlBAgQIECAAAECBAgQIECAAAEhij1AgAABAgQIECBAgAABAgQIEGgQEKI0IFlCgAABAgQIECBAgAABAgQIEBCi2AMECBAgQIAAAQIECBAgQIAAgQYBIUoDkiUECBAgQIAAAQIECBAgQIAAASGKPUCAAAECBAgQIECAAAECBAgQaBAQojQgWUKAAAECBAgQIECAAAECBAgQEKLYAwQIECBAgAABAgQIECBAgACBBgEhSgOSJQQIECBAgAABAgQIECBAgAABIYo9QIAAAQIECBAgQIAAAQIECBBoEBCiNCBZQoAAAQIECBAgQIAAAQIECBAQotgDBAgQIECAAAECBAgQIECAAIEGASFKA5IlBAgQIECAAAECBAgQIECAAAEhij1AgAABAgQIECBAgAABAgQIEGgQEKI0IFlCgAABAgQIECBAgAABAgQIEBCi2AMECBAgQIAAAQIECBAgQIAAgQYBIUoDkiUECBAgQIAAAQIECBAgQIAAASGKPUCAAAECBAgQIECAAAECBAgQaBAQojQgWUKAAAECBAgQIECAAAECBAgQEKLYAwQIECBAgAABAgQIECBAgACBBgEhSgOSJQQIECBAgAABAgQIECBAgAABIYo9QIAAAQIECBAgQIAAAQIECBBoEBCiNCBZQoAAAQIECBAgQIAAAQIECBAQotgDBAgQIECAAAECBAgQIECAAIEGASFKA5IlBAgQIECAAAECBAgQI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BAgAABAtMSEKJMa966JTAUgdkHyT7SFftuPR4aSuHqJECAAAECBAgQIEBgvAJClPHOVmcEhipwsgp/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); 

任何幫助將非常感激。如果您需要更多信息,請與我們聯繫。

+0

創建的png文件的大小是多少?你有沒有用文本編輯器或十六進制編輯器查看創建的png文件?它是什麼樣子的? – NineBerry

+0

PNG文件是11kb。這是Notepad ++中文件頭幾行的樣子; ‰PNG IHDR Q˚F•ÿIDATx^^ IYO¥wZðLA0Ag1Af'!*Ê4ÙH\tíÆÍHŠbÆ®「杜\t ILU」BêÆw2ÉBi»tÎFaÚi「A ...ãbÚTp – user1848023

+0

如果我的回答對您有所幫助,請把它標記爲正確的通過點擊除了它之外的複選標記來回答。謝謝。 – NineBerry

回答

0

PNG文件包含透明背景。您可以通過在黑色背景的html文件中使用數據uri來測試。這也是png(從Firefox保存)在paint.net中的樣子。它具有透明背景:enter image description here

向我們展示您用於在網站中建立簽名板的代碼並獲取圖像。您需要確保將SignaturePad的backgroundColor參數指定爲非透明顏色。

var signaturePad = new SignaturePad(c, { 
    backgroundColor: "white", 
    minWidth: 5, 
    maxWidth: 10, 
    penColor: "black" 
}); 
0

謝謝!我有一個調整大小的事件,即使我之前設置了背景,也會從圖像中刪除背景。現在全部設置。