function pdf_to_imagefield_save_converted in PDF to ImageField 6.2
Same name and namespace in other branches
- 6 pdf_to_imagefield.module \pdf_to_imagefield_save_converted()
- 7 pdf_to_imagefield.module \pdf_to_imagefield_save_converted()
Save converted images as ImageField files
File
- ./
pdf_to_imagefield.module, line 87 - PDF to ImageField core hooks and menu callbacks.
Code
function pdf_to_imagefield_save_converted($images, $field, $pdf) {
foreach (filefield_get_file_references($pdf) as $nid => $vid) {
$node = node_load($nid);
if (count($images)) {
foreach ($images as $image) {
$image->list = FALSE;
$node->{$field['field_name']}[] = (array) $image;
}
node_save($node);
watchdog('pdf_to_imagefield', '%images preview images generated for %title node from %pdf PDF file.', array(
'%images' => count($images),
'%title' => $node->title,
'%pdf' => $pdf['filename'],
));
}
else {
watchdog('pdf_to_imagefield', 'No pdf previews generated for %title node from %pdf PDF file. But it is still in cron list.', array(
'%title' => $node->title,
'%pdf' => $pdf['filename'],
), WATCHDOG_ERROR);
}
}
}