You are here

public static function TokenResolver::getSignatureImage in FillPDF 5.0.x

Same name and namespace in other branches
  1. 8.4 src/TokenResolver.php \Drupal\fillpdf\TokenResolver::getSignatureImage()

Convert the base64-encoded signature image into regular image data.

The result can be fed into an ImageFieldMapping.

Parameters

string $webform_element_value: The value from the Webform submission, retrieved using the getElementData() method.

Return value

string The signature image as a string to save to a file or stream.

See also

\Drupal\fillpdf\FieldMapping\ImageFieldMapping

2 calls to TokenResolver::getSignatureImage()
PdfWebformPopulationTest::testPdfPopulation in tests/src/Functional/PdfWebformPopulationTest.php
Tests Webform population and image stamping.
TokenResolver::parseImageWebformElementTokens in src/TokenResolver.php
Scans a potential webform image element token.

File

src/TokenResolver.php, line 254

Class

TokenResolver
Class TokenResolver.

Namespace

Drupal\fillpdf

Code

public static function getSignatureImage($webform_element_value) {
  return base64_decode(preg_replace('#^data:image/\\w+;base64,#i', '', $webform_element_value));
}