You are here

function _pdfpreview_create_preview in PDFPreview 6

Same name and namespace in other branches
  1. 7.2 pdfpreview.module \_pdfpreview_create_preview()
  2. 7 pdfpreview.module \_pdfpreview_create_preview()

Creates the PDF preview file and returns its URI

Parameters

File $file:

Return value

string URI of the newly created preview image

See also

_pdfpreview_convert_first_page()

pdfpreview_field_formatter_view()

1 call to _pdfpreview_create_preview()
theme_pdfpreview_formatter in ./pdfpreview.module
Theming functions for our formatters

File

./pdfpreview.module, line 269
This module creates a formatter for CCK filefields that shows a snapshot of the first page of pdf files as link to the file.

Code

function _pdfpreview_create_preview($file) {
  if (!is_array($file)) {
    $file = (array) $file;
  }
  $output_filename = _pdfpreview_output_filename($file);

  // Create preview image using ImageMagick
  if (!file_exists($output_filename) && function_exists('_imageapi_imagemagick_convert_exec')) {
    _pdfpreview_convert_first_page($file['filepath'], $output_filename);
  }
  return $output_filename;
}