You are here

function pdf_to_imagefield_check_imagemagick in PDF to ImageField 6.2

Same name and namespace in other branches
  1. 6 pdf_to_imagefield.module \pdf_to_imagefield_check_imagemagick()
  2. 7 pdf_to_imagefield.module \pdf_to_imagefield_check_imagemagick()

Helper function to check if ImageMagick is ready to convert

2 calls to pdf_to_imagefield_check_imagemagick()
pdf_to_imagefield_requirements in ./pdf_to_imagefield.install
Implementation of hook_requirements().
pdf_to_imagefield_widget_settings_form in ./pdf_to_imagefield.module
Implementation of CCK's hook_widget_settings($op = 'form').

File

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

Code

function pdf_to_imagefield_check_imagemagick($widget) {

  // init test varaibles
  $source = drupal_get_path('module', 'pdf_to_imagefield') . '/imagemagick_test.pdf';
  $result = file_directory_path() . '/imagemagick_test.jpg';
  $density = !empty($widget['density']) ? $widget['density'] : '100x100';

  // check conversion
  if (pdf_to_imagefield_convert_pdf($source, $result, array(), array(
    '-density ' . $density,
  ))) {
    file_delete($result);
    return TRUE;
  }
  return FALSE;
}