Feb 19, 2022
0
Level 1
jQuery Signature for mobile
Hello, experts why its not working for mobile ? what should i need to include to solve this problem
<form method="POST" action="{{ route('signaturepad.upload') }}">
@csrf
<div class="col-md-12">
<input type="hidden" name="id" value="{{ $token }}">
<label class="" for="">Signature:</label>
<div id="sig"></div>
<button id="clear" class="btn btn-danger btn-sm">Clear Signature</button>
<textarea id="signature64" name="signed" style="display: none"></textarea>
</div>
<button class="btn btn-success">Save</button>
</form>
</div>
</div>
</div>
</div>
</div>
<script type="text/javascript">
var sig = $('#sig').signature({
syncField: '#signature64',
syncFormat: 'PNG'
});
$('#clear').click(function(e) {
e.preventDefault();
sig.signature('clear');
$("#signature64").val('');
});
</script>
And my controller
$folderPath = public_path('upload/');
$image_parts = explode(";base64,", $request->signed);
$image_type_aux = explode("image/", $image_parts[0]);
$image_type = $image_type_aux[1];
$image_base64 = base64_decode($image_parts[1]);
$file = $folderPath .$request->id. '.'.$image_type;
file_put_contents($file, $image_base64);
// return back()->with('success', 'success Full upload signature');
return redirect('generate-pdf/'.$request->id);
Please or to participate in this conversation.