function _pdfpreview_output_filename in PDFPreview 6
Same name and namespace in other branches
- 7.2 pdfpreview.module \_pdfpreview_output_filename()
2 calls to _pdfpreview_output_filename()
- pdfpreview_file_delete in ./
pdfpreview.module - Implements hook_file_delete()
- _pdfpreview_create_preview in ./
pdfpreview.module - Creates the PDF preview file and returns its URI
File
- ./
pdfpreview.module, line 164 - 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_output_filename($file) {
if (!is_object($file)) {
$file = (object) $file;
}
$output_dir = file_directory_path() . '/' . variable_get('pdfpreview_pathtoimages', 'pdfpreview');
if (variable_get('pdfpreview_filenames', PDFPREVIEW_FILENAMES_MACHINE) == PDFPREVIEW_FILENAMES_HUMAN) {
$filename = basename($file->filename, '.pdf');
if (module_exists('transliteration')) {
$filename = transliteration_clean_filename($filename);
}
return $output_dir . '/' . $file->fid . '-' . $filename . '.jpg';
}
else {
return $output_dir . '/' . md5($file->fid) . '.jpg';
}
}