Hi Y'all:

 

I am stumped. I want to save the contents of an HTML5 canvas to a png image
file. The following code is from the Internet, but the file that is saved is
not a valid image file. So far, this is what I have: 

 

I pass the image as a 64 bit text image to the server using the following
form element:

 

document.form.signature_url.value = signaturePad.toDataURL();



On the server, I: 

 

use MIME::Base64 qw( decode_base64url ); I get the same results if I use
decode_base64

 

@encoded_signature = split/,/, $signature_url;

$decoded_signature = decode_base64url($encoded_signature[1]);



Then I save the image:

 

$filename = 'sig_'.$client_id.'_'.$mySqlDate.'_'.$sigTime.'.png';
$rootPathSigsFilename = $rootPathSigs.'/'.$filename;



open(SIG, ">$rootPathSigsFilename");
print SIG $decoded_signature;
close(SIG);



The image is indeed saved and it is about 30k in size but the saved image is
invalid.

 

>From what I can glean the issue may have something to do with URI versus
UURL formatting, but what do I know.

 

Any suggestions will be greatly appreciated.

 

Fraser

 

_______________________________________________
Houston mailing list
[email protected]
http://mail.pm.org/mailman/listinfo/houston
Website: http://houston.pm.org/

Reply via email to