You are here

function pdf_to_imagefield_file_insert in PDF to ImageField 6

Implementation of hook_file_insert().

Add file to table

File

./pdf_to_imagefield.module, line 244
PDF to ImageField core hooks and menu callbacks.

Code

function pdf_to_imagefield_file_insert($file) {
  if (pdf_to_imagefield_check_file($file)) {
    $pdf = new stdClass();
    $pdf->fid = $file->fid;
    $pdf->field = $file->field['widget']['target_imagefield'];
    $pdf->count = 0;
    $pdf->density_x = preg_replace('/^([0-9]+)x[0-9]+$/', '\\1', $file->field['widget']['density']);
    $pdf->density_y = preg_replace('/^[0-9]+x([0-9]+)$/', '\\1', $file->field['widget']['density']);
    $pdf->finished = 0;
    drupal_write_record('pdf_to_imagefield', $pdf);
  }
}