function pdf_to_imagefield_convert_pdf in PDF to ImageField 6
Same name and namespace in other branches
- 6.2 pdf_to_imagefield.module \pdf_to_imagefield_convert_pdf()
- 7 pdf_to_imagefield.module \pdf_to_imagefield_convert_pdf()
Convert function (depends on ImageAPI module) This is almost a copy of _imageapi_imagemagick_convert() function, with that addition of $extra argument, used to pass parameters to convert *BEFORE* source file specification. Here it is needed to set density before rendering a PDF
2 calls to pdf_to_imagefield_convert_pdf()
- pdf_to_imagefield_check_imagemagick in ./
pdf_to_imagefield.module - Helper function to check if ImageMagick is ready to convert
- pdf_to_imagefield_convert_pages in ./
pdf_to_imagefield.module - Convert pages from pdf file to ImageField files
2 string references to 'pdf_to_imagefield_convert_pdf'
- pdf_to_imagefield_cron in ./
pdf_to_imagefield.module - Implementation of hook_cron().
- pdf_to_imagefield_settings_form in ./
pdf_to_imagefield.module - Menu callback. Administrator settings
File
- ./
pdf_to_imagefield.module, line 200 - PDF to ImageField core hooks and menu callbacks.
Code
function pdf_to_imagefield_convert_pdf($source, $dest, $args = array(), $extra = array()) {
$d_arguments['quality'] = '-quality ' . escapeshellarg(variable_get('imageapi_imagemagick_quality', 75));
// To make use of ImageMagick 6's parenthetical command grouping we need to make
// the $source image the first parameter and $dest the last.
// See http://www.imagemagick.org/Usage/basics/#cmdline for more info.
$command = implode(' ', $extra) . ' ' . escapeshellarg($source) . ' ' . implode(' ', $args) . ' ' . escapeshellarg($dest);
if (0 != _imageapi_imagemagick_convert_exec($command, $output, $errors)) {
$errors_txt = '<pre>' . (is_array($errors) ? implode("\n", $errors) : $errors) . '</pre>';
watchdog('pdf to image: imageapi imagemagick', '!errors', array(
'!errors' => $errors_txt,
), WATCHDOG_ERROR);
return FALSE;
}
return file_exists($dest);
}