Hi Guys,
So i am using the signature widget and storing the image using the below code:
<?php
$data_uri = $this->data('signature');
$encoded_image = explode(",", $data_uri)[1];
$decoded_image = base64_decode($encoded_image);
file_put_contents("signature.png", $decoded_image)
?>
What I want to do is store the signature image with a unique name based on a data variable from the field i.e. {data:name}
How can I edit the above file_put_contents("signature.png", $decoded_image) to replace signature.png with a variable name?
So i am using the signature widget and storing the image using the below code:
<?php
$data_uri = $this->data('signature');
$encoded_image = explode(",", $data_uri)[1];
$decoded_image = base64_decode($encoded_image);
file_put_contents("signature.png", $decoded_image)
?>
What I want to do is store the signature image with a unique name based on a data variable from the field i.e. {data:name}
How can I edit the above file_put_contents("signature.png", $decoded_image) to replace signature.png with a variable name?
file_put_contents($this->data('field_name', '') . ".png", $decoded_image);
Have a care though - what happens if two people put the same data in the field?
Have a care though - what happens if two people put the same data in the field?
Thanks so so much! going to test this out now.
The field is a unique identifier via my API call so will always be unique to that user.
Thanks again! going to test now
The field is a unique identifier via my API call so will always be unique to that user.
Thanks again! going to test now
This topic is locked and no more replies can be posted.