Merge pull request #115 from nonmakina/pdfThumbnail

Turns on thumbnails for pdf and djvu filetypes
This commit is contained in:
towards-a-new-leftypol 2021-01-10 11:19:17 -05:00 committed by GitHub
commit 663233f34d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 5 additions and 1 deletions

View File

@ -133,6 +133,9 @@ $config['max_filesize'] = 50 * 1024 * 1024; // 50MB
$config['webm']['allow_audio'] = true; $config['webm']['allow_audio'] = true;
$config['webm']['max_length'] = 1000; $config['webm']['max_length'] = 1000;
$config['pdf_file_thumbnail'] = true;
$config['djvu_file_thumbnail'] = true;
// Allowed image file extensions. // Allowed image file extensions.
$config['allowed_ext'][] = 'jpg'; $config['allowed_ext'][] = 'jpg';
$config['allowed_ext'][] = 'jpeg'; $config['allowed_ext'][] = 'jpeg';

View File

@ -100,7 +100,8 @@ $(document).ready(function(){
for (var i = 0; i < link.length; i++) { for (var i = 0; i < link.length; i++) {
if (typeof link[i] == "object" && link[i].childNodes && typeof link[i].childNodes[0] !== 'undefined' && if (typeof link[i] == "object" && link[i].childNodes && typeof link[i].childNodes[0] !== 'undefined' &&
link[i].childNodes[0].src && link[i].childNodes[0].className.match(/post-image/) && !link[i].className.match(/file/)) { link[i].childNodes[0].src && link[i].childNodes[0].className.match(/post-image/) && !link[i].className.match(/file/) &&
!link[i].href.match("\\.(pdf|djvu|djv)$") ) {
link[i].onclick = function(e) { link[i].onclick = function(e) {
var img, post_body, still_open, canvas, scroll; var img, post_body, still_open, canvas, scroll;
var thumb = this.childNodes[0]; var thumb = this.childNodes[0];