You are here

function pdf_to_imagefield_check_imagemagick in PDF to ImageField 7

Same name and namespace in other branches
  1. 6.2 pdf_to_imagefield.module \pdf_to_imagefield_check_imagemagick()
  2. 6 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_field_widget_settings_form in ./pdf_to_imagefield.module
Implements hook_widget_settings($op = 'form')().
pdf_to_imagefield_requirements in ./pdf_to_imagefield.install
Implements hook_requirements().

File

./pdf_to_imagefield.module, line 684
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;
}