Skip to content
Snippets Groups Projects
Commit 4d2d5aa5 authored by Kevin Kaland's avatar Kevin Kaland
Browse files

Issue #1589854: Ensure field on node is set.

parent c8b33114
No related branches found
No related tags found
No related merge requests found
...@@ -360,17 +360,19 @@ function fillpdf_merge_pdf($fid, $nids = NULL, $webform_arr = NULL, $sample = NU ...@@ -360,17 +360,19 @@ function fillpdf_merge_pdf($fid, $nids = NULL, $webform_arr = NULL, $sample = NU
$left_side = strpos($obj->value, '[stamp:') + 7; $left_side = strpos($obj->value, '[stamp:') + 7;
$right_side = strpos($obj->value, ']'); $right_side = strpos($obj->value, ']');
$field_name = substr($obj->value, $left_side, $right_side - $left_side); $field_name = substr($obj->value, $left_side, $right_side - $left_side);
$image_path = $node->{$field_name}[$node->language][0]['uri']; if (isset($node->{$field_name}[$node->language])) {
$transform_string = FALSE; $image_path = $node->{$field_name}[$node->language][0]['uri'];
$fields[$obj->pdf_key] = '{image}' . drupal_realpath($image_path); $transform_string = FALSE;
$image_path_info = pathinfo(drupal_realpath($image_path)); $fields[$obj->pdf_key] = '{image}' . drupal_realpath($image_path);
// Store the image data to transmit to the remote service if necessary $image_path_info = pathinfo(drupal_realpath($image_path));
$file_data = file_get_contents(drupal_realpath($image_path)); // Store the image data to transmit to the remote service if necessary
if ($file_data) { $file_data = file_get_contents(drupal_realpath($image_path));
$image_data[$obj->pdf_key] = array( if ($file_data) {
'data' => base64_encode($file_data), $image_data[$obj->pdf_key] = array(
'filenamehash' => md5($image_path_info['filename']) . '.' . $image_path_info['extension'], 'data' => base64_encode($file_data),
); 'filenamehash' => md5($image_path_info['filename']) . '.' . $image_path_info['extension'],
);
}
} }
} }
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment