Closed flovro closed 8 years ago
I think you'd have to grab the signature’s image, as a PNG, either using the getSignatureImage()
function or use something like the Signature to Image PHP convertor.
After you have a PNG image you can attach that to the mail message.
this is how it's look the message body part:
if (!empty($_POST["output2"])) {
$caregiver_signature = test_input($_POST["output2"]);
$msg .= "Caregiver Signature: <img src='$caregiver_signature'<br/>";
$msg .="\r";
}
the getSignatureImage() can be used just inside the javascript?
thanks
Yeah, it can be used in Javascript. Or you can use this PHP convertor to generate the image: https://github.com/thomasjbradley/signature-to-image
yes but on the email is not working that signature to image... maybe use like
$json = $_POST['output2']; // From Signature Pad
$img = sigJsonToImage($json);
$sign = imagepng($img, 'signature.png');
$message .= "Signature: "'.$sign.'"
PS: I'm new to PHP :) I tried the above method and on email I got something like "Signature: 1" what do you think?
I also got this issue: Warning: Invalid argument supplied for foreach() in /nfs/c09/h01/mnt/209663/domains/aphria.com/html/signature-to-image.php on line 58
On the last line of the code above, we can’t just include an image like you've done. We need to add the image to the email as an attachment. Maybe look into some PHP code to help you add attachments to emails for PHP.
For the error, my thought is that maybe the $json
variable is empty?
$json variable is not empty. :(
How to save on the server the signature? for example www.sitename.com/signatures/client_name.jpg ? and when I have multiple signatures?
Many thanks
The code you posted above, will do exactly that:
$sign = imagepng($img, 'signature.png');
It should save a file named signature.png
.
and where it will save the image? on the server?
Yep, to the path you specify as the second argument.
Where is says signtare.png
—that’s the path it will save to.
Hi Thomas! Saving the image to the server I got this
Warning: Invalid argument supplied for foreach() in /server_path/html/signature-to-image.php on line 58
Warning: imagepng() expects parameter 1 to be resource, null given in /server_path/html/register-validation.php on line 188
What to do?
I don’t know exactly what that code is doing.
I would try doing print($json)
and see what gets output first.
Should look like this, but really long: [{"lx":20,"ly":34,"mx":20,"my":34},{"lx":21,"ly":33,"mx":20,"my":34}…
Hi Thomas! If I will give you the access to ftp will you glad to help me? thanks PS: I really need this Cu stima, Florin Sbarcea
On Tuesday, March 8, 2016 5:55 PM, Thomas J Bradley <notifications@github.com> wrote:
I don’t know exactly what that code is doing. I would try doing print($json) and see what gets output first. Should look like this, but really long: [{"lx":20,"ly":34,"mx":20,"my":34},{"lx":21,"ly":33,"mx":20,"my":34}…— Reply to this email directly or view it on GitHub.
I can take a quick look when I get a chance.
Hi Thomas!
I managed how to save an image to the server via this code:
//Patient Signature
if (!empty($_POST['output'])) {
$patient_signature = $_POST['output']; // From Signature Pad
require_once 'signature-to-image.php';
$img1 = sigJsonToImage($patient_signature);
$sign1 = imagepng($img1, $_SERVER['DOCUMENT_ROOT'].'/signatures/'.$firstname.'_'.$lastname.'_signature.png');
}
When I'm trying to save the second image on the server it;s not saving even I have the right base64 code from $_post[output2]
How to save the output2 on the server, same for output3
Many thanks
That code should work okay, by just changing $_POST['output2']
etc.
Did you change the <input name="output2">
in the HTML also?
yes I have changed that also on the html
if (!empty($_POST['output3'])) {
$caregiver_patient_signature = $_POST['output3']; // From Signature Pad
require_once 'signature-to-image.php';
$img3 = sigJsonToImage($caregiver_patient_signature);
$sign3 = imagepng($img3, $_SERVER['DOCUMENT_ROOT'].'/signatures/'.$caregiver_patient_name.'_signature_car_pat.png');
}
and also I got the json(base64 code) for the second and third image but not saving on the server
There aren't any errors showing in the PHP?
no error
Maybe try moving the require_once
up higher in the code and deleting it from each of the if-statements.
I did that and same only first image it's saving on the server. To be a server issue? also after submiting the form, only after 7 minutes I'm getting the email with the first image as attachement and as link.
Also I have increased the width and the height of the canvas. How to move a little bit down that light grey border? Or to remove that light grey border
Try debugging the if-statements to see if they are running. One simple way would be to write something like echo 'in 2nd if';
at the top of each of them.
Border: https://github.com/thomasjbradley/signature-pad/blob/gh-pages/documentation.md#options-reference
lineColour
, lineWidth
, lineTop
ok will do that :)
if-statements are working, I got for each if their echo. What to do?
Hi!
I'm using this plugin to add the signature for a form. I'm using the multi-signature. Everything works great. I want when I press submit buttom to got the signature in the email (as attachment). Using the "plan text" mail format I got the json code of the image, but when I tried to display on the HTML mail I got no code.
How to do?
Many thanks