Hi Christophe,
Please use the Signature element from the Widgets group in the Designer tab.
Bob
Please use the Signature element from the Widgets group in the Designer tab.
Bob
How to recover the signature, please?
{data:signature} produces an encoded image in the html
{var:signature} in attached file -> error no email
Thanks
{data:signature} produces an encoded image in the html
{var:signature} in attached file -> error no email
Thanks
$this-> and no $form->
All works except the attached file, i think it comes from the code $form->files...
I tried $this-> but not
Do you have any idea?
<?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 to the form data
$this->data['signature'] = $sig_name;
$form->files['signature']['name'] = $sig_name;
$form->files['signature']['link'] = $url.$sig_name;
$form->files['signature']['path'] = $path.$sig_name;
// display the image if needed
echo "<img src='{$url}{$sig_name}' />";
// to add the image to an email add this line
// and put {sig_img} in the email template
$this->data['sig_img'] = "<img src='{$url}{$sig_name}' />";
?>
All works except the attached file, i think it comes from the code $form->files...
I tried $this-> but not
Do you have any idea?
<?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 to the form data
$this->data['signature'] = $sig_name;
$form->files['signature']['name'] = $sig_name;
$form->files['signature']['link'] = $url.$sig_name;
$form->files['signature']['path'] = $path.$sig_name;
// display the image if needed
echo "<img src='{$url}{$sig_name}' />";
// to add the image to an email add this line
// and put {sig_img} in the email template
$this->data['sig_img'] = "<img src='{$url}{$sig_name}' />";
?>
Hi Christophe,
I was able to display an image by replacing the last five lines (starting //display this image) with
This should also work in an email body - my tests have not been delivered for some reason though the Debugger shows success.
Bob
I was able to display an image by replacing the last five lines (starting //display this image) with
return $url.$sig_name;and then using this in a Custom Code action
<div><img src='{var:php6}' /></div>where php6 was the name of my PHP action.
This should also work in an email body - my tests have not been delivered for some reason though the Debugger shows success.
Bob
Hi Bob,
Display image works well.
Only add file to email doesn't work.
$form->files['signature']['name'] = $sig_name;
$form->files['signature']['link'] = $url.$sig_name;
$form->files['signature']['path'] = $path.$sig_name;
I think it's not : $form->files
Regards
Display image works well.
Only add file to email doesn't work.
$form->files['signature']['name'] = $sig_name;
$form->files['signature']['link'] = $url.$sig_name;
$form->files['signature']['path'] = $path.$sig_name;
I think it's not : $form->files
Regards
Hi Christophe,
It is not $form->files - but I can't work out what it is.
In my test I tried adding the display div in the email body - I think that should work OK.
Bob
It is not $form->files - but I can't work out what it is.
In my test I tried adding the display div in the email body - I think that should work OK.
Bob
Hi Bob,
Save to directory and img in mail works well.
only attached file doesn't
regards
Chris
Save to directory and img in mail works well.
only attached file doesn't
regards
Chris
Hi Christophe,
Please try this version - replace the 'return' section of the PHP code with this:
Bob
Please try this version - replace the 'return' section of the PHP code with this:
// add the file info into the form dataThen you can use {var:php6.path} in the email body or to display on the site as before and {var:php6.url} in the Attachments list of the Email action. (Replacing php6 with the name of your php action.)
return array(
'url' => $url.$sig_name,
'path' => $path.$sig_name
);
Bob
This topic is locked and no more replies can be posted.