You are here

function _fillpdf_prepare_image_data in FillPDF 7

Prepare image data.

Parameters

$image_path:

$obj:

$fields:

$image_data:

$transform_string:

2 calls to _fillpdf_prepare_image_data()
fillpdf_merge_pdf in ./fillpdf.module
Constructs a page and sends it to the browser or saves it.
_fillpdf_process_image_tokens in ./fillpdf.module
Process image tokens.

File

./fillpdf.module, line 998

Code

function _fillpdf_prepare_image_data($image_path, $obj, &$fields, &$image_data, &$transform_string) {
  $real_image_path = drupal_realpath($image_path);
  $image_path_info = pathinfo($real_image_path);

  // Store the image data to transmit to the remote service if necessary.
  if (!file_exists($real_image_path)) {

    // We matched the token, but there was no file set.
    $transform_string = TRUE;
  }
  else {
    $file_data = file_get_contents($real_image_path);
    $fields[$obj->pdf_key] = '{image}' . $real_image_path;
    $image_data[$obj->pdf_key] = array(
      'data' => base64_encode($file_data),
      'filenamehash' => md5($image_path_info['filename']) . '.' . $image_path_info['extension'],
    );
    $transform_string = FALSE;
  }
}