function _pdfpreview_create_preview in PDFPreview 7
Same name and namespace in other branches
- 6 pdfpreview.module \_pdfpreview_create_preview()
- 7.2 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()
- pdfpreview_field_formatter_view in ./
pdfpreview.module - Implements hook_field_formatter_view()
File
- ./
pdfpreview.module, line 210 - This file contains hooks for the pdfpreview module
Code
function _pdfpreview_create_preview($file) {
$output_dir = file_default_scheme() . '://' . variable_get('pdfpreview_pathtoimages', 'pdfpreview');
$output_filename = $output_dir . '/' . md5('pdfpreview' . $file->fid) . '.jpg';
// Create preview image using ImageMagick
if (!file_exists($output_filename) && function_exists('_imagemagick_convert')) {
$pdf = drupal_realpath($file->uri);
_pdfpreview_convert_first_page($pdf, $output_filename);
}
return $output_filename;
}