Initial implementation for Thumbnails for PDFs / other things #6, requires ['pdf_file_thumbnail'] is set to true and using convert from imagemagick. If ['pdf_file_thumbnail'] is false then it uses standard configured static file icon
This commit is contained in:
parent
5684461902
commit
f3a5eb0940
20
post.php
20
post.php
@ -985,6 +985,25 @@ if (isset($_POST['delete'])) {
|
||||
}
|
||||
$image->destroy();
|
||||
} else {
|
||||
if ($file['extension'] == "pdf" && $config['pdf_file_thumbnail']){
|
||||
$path = $file['thumb'];
|
||||
$error = shell_exec_error( 'convert -thumbnail x300 -background white -alpha remove ' .
|
||||
escapeshellarg($file['tmp_name']. '[0]') . ' ' .
|
||||
escapeshellarg($file['thumb']));
|
||||
|
||||
if ($error){
|
||||
$path = sprintf($config['file_thumb'],isset($config['file_icons'][$file['extension']]) ? $config['file_icons'][$file['ext
|
||||
ension']] : $config['file_icons']['default']);
|
||||
}
|
||||
|
||||
$file['thumb'] = basename($file['thumb']);
|
||||
$size = @getimagesize($path);
|
||||
$file['thumbwidth'] = $size[0];
|
||||
$file['thumbheight'] = $size[1];
|
||||
$file['width'] = $size[0];
|
||||
$file['height'] = $size[1];
|
||||
}
|
||||
else {
|
||||
// not an image
|
||||
//copy($config['file_thumb'], $post['thumb']);
|
||||
$file['thumb'] = 'file';
|
||||
@ -994,6 +1013,7 @@ if (isset($_POST['delete'])) {
|
||||
$config['file_icons'][$file['extension']] : $config['file_icons']['default']));
|
||||
$file['thumbwidth'] = $size[0];
|
||||
$file['thumbheight'] = $size[1];
|
||||
}
|
||||
}
|
||||
|
||||
if ($config['tesseract_ocr'] && $file['thumb'] != 'file') { // Let's OCR it!
|
||||
|
Loading…
Reference in New Issue
Block a user