Forums

Signature widget

Le Pache 22 Jun, 2020
Hi everybody. I need some help, please !
I would like transform signature data on png. So I have put a custom code at the top of the submit area as explained here : https://www.chronoengine.com/faqs/70-chronoforms/cfv5/5254-how-can-i-use-the-[color=#a333c8
I get a syntax error, unexpected '' (T_STRING)
I don't understand why...
Thank you for help ![pre]<?php
$data_pieces = explode(",", $this->data[signature]);
$encoded_image = $data_pieces[1];
$decoded_image = base64_decode($encoded_image);

// set the folder where the images will be saved
$folder = 'images/signatures/';
$path = JPATH_SITE.'/'.$folder;
$url = JURI::root().$folder;
// sets a file name using a date-time prefix to make sure it is unique
$sig_name = date('Ymd-his').'_signature.png';
file_put_contents( $path.$sig_name, $decoded_image);

// add the file info into the form data
return array(
'url' => $url.$sig_name,
'path' => $path.$sig_name
);
?>[/pre]
GreyHead 24 Jun, 2020
Hi Le Pache,

Please can you post the rest of the Error message - normally that tells you where the error is located.

Bob
Le Pache 24 Jun, 2020
1 Likes
Hi GreyHead,
I just had Error 0, unexpected '' (T_STRING)
I finally used the SkySpider SigtoImage plugin
Many thanks GreyHead !
This topic is locked and no more replies can be posted.