From 2e6d730ee69e1e7ab4198a0187433e700470bd70 Mon Sep 17 00:00:00 2001 From: Disassembler Date: Sat, 7 Oct 2017 22:30:39 +0200 Subject: [PATCH] Add SeedDMS Previewers and PdfPreviewers --- 10-seeddms.sh | 3 +++ seeddms/seeddms-previewers.patch | 42 ++++++++++++++++++++++++++++++++ 2 files changed, 45 insertions(+) create mode 100644 seeddms/seeddms-previewers.patch diff --git a/10-seeddms.sh b/10-seeddms.sh index 5c6fedf..e797cb0 100755 --- a/10-seeddms.sh +++ b/10-seeddms.sh @@ -11,6 +11,9 @@ tar xzf /srv/seeddms.tgz -C /srv mv /srv/seeddms51x /srv/seeddms rm -f /srv/seeddms.tgz +# Patch Previewers +patch -d /srv/seeddms -p0 <${SOURCE_DIR}/seeddms/seeddms-previewers.patch + # Populate database export SEEDDMS_PWD=$(head -c 18 /dev/urandom | base64) envsubst <${SOURCE_DIR}/seeddms/tmp/seeddms-createdb.sql >/tmp/seeddms-createdb.sql diff --git a/seeddms/seeddms-previewers.patch b/seeddms/seeddms-previewers.patch new file mode 100644 index 0000000..75ea814 --- /dev/null +++ b/seeddms/seeddms-previewers.patch @@ -0,0 +1,42 @@ +diff -ruN orig/SeedDMS/Preview/PdfPreviewer.php pear/SeedDMS/Preview/PdfPreviewer.php +--- orig/SeedDMS/Preview/PdfPreviewer.php 2017-05-03 14:14:18.000000000 +0200 ++++ pear/SeedDMS/Preview/PdfPreviewer.php 2017-10-07 19:01:01.169624330 +0200 +@@ -27,10 +27,15 @@ + function __construct($previewDir, $timeout=5) { /* {{{ */ + parent::__construct($previewDir, $timeout); + $this->converters = array( +- 'application/vnd.openxmlformats-officedocument.wordprocessingml.document' => "unoconv -d document -f pdf --stdout -v '%f' > '%o'", +- 'application/vnd.oasis.opendocument.text' => "unoconv -d document -f pdf --stdout -v '%f' > '%o'", + 'text/rtf' => "unoconv -d document -f pdf --stdout -v '%f' > '%o'", + 'application/msword' => "unoconv -d document -f pdf --stdout -v '%f' > '%o'", ++ 'application/vnd.oasis.opendocument.text' => "unoconv -d document -f pdf --stdout -v '%f' > '%o'", ++ 'application/vnd.openxmlformats-officedocument.wordprocessingml.document' => "unoconv -d document -f pdf --stdout -v '%f' > '%o'", ++ 'application/vnd.ms-excel' => "unoconv -d spreadsheet -f pdf --stdout -v '%f' > '%o'", ++ 'application/vnd.oasis.opendocument.spreadsheet' => "unoconv -d spreadsheet -f pdf --stdout -v '%f' > '%o'", ++ 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet' => "unoconv -d spreadsheet -f pdf --stdout -v '%f' > '%o'", ++ 'text/html' => "unoconv -d document -f pdf --stdout -v '%f' > '%o'", ++ 'text/plain' => "unoconv -d document -f pdf --stdout -v '%f' > '%o'", + ); + } /* }}} */ + +diff -ruN orig/SeedDMS/Preview/Previewer.php pear/SeedDMS/Preview/Previewer.php +--- orig/SeedDMS/Preview/Previewer.php 2017-05-03 14:14:18.000000000 +0200 ++++ pear/SeedDMS/Preview/Previewer.php 2017-10-07 19:02:22.781623907 +0200 +@@ -40,7 +40,16 @@ + 'text/plain' => "convert -resize %wx '%f' '%o'", + 'application/pdf' => "convert -density 100 -resize %wx '%f[0]' '%o'", + 'application/postscript' => "convert -density 100 -resize %wx '%f[0]' '%o'", +- 'application/x-compressed-tar' => "tar tzvf '%f' | convert -density 100 -resize %wx text:-[0] '%o", ++ 'application/x-compressed-tar' => "tar tzvf '%f' | convert -density 100 -resize %wx text:-[0] '%o'", ++ 'text/rtf' => "unoconv -d document -e PageRange=1-1 -f pdf --stdout '%f' | convert -resize %wx pdf:- '%o'", ++ 'application/msword' => "unoconv -d document -e PageRange=1-1 -f pdf --stdout '%f' | convert -resize %wx pdf:- '%o'", ++ 'application/vnd.oasis.opendocument.text' => "unoconv -d document -e PageRange=1-1 -f pdf --stdout '%f' | convert -resize %wx pdf:- '%o'", ++ 'application/vnd.openxmlformats-officedocument.wordprocessingml.document' => "unoconv -d document -e PageRange=1-1 -f pdf --stdout '%f' | convert -resize %wx pdf:- '%o'", ++ 'application/vnd.ms-excel' => "unoconv -d spreadsheet -e PageRange=1-1 -f pdf --stdout '%f' | convert -resize %wx pdf:- '%o'", ++ 'application/vnd.oasis.opendocument.spreadsheet' => "unoconv -d spreadsheet -e PageRange=1-1 -f pdf --stdout '%f' | convert -resize %wx pdf:- '%o'", ++ 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet' => "unoconv -d spreadsheet -e PageRange=1-1 -f pdf --stdout '%f' | convert -resize %wx pdf:- '%o'", ++ 'text/html' => "unoconv -d document -e PageRange=1-1 -f pdf --stdout '%f' | convert -resize %wx pdf:- '%o'", ++ 'text/plain' => "unoconv -d document -e PageRange=1-1 -f pdf --stdout '%f' | convert -resize %wx pdf:- '%o'", + ); + $this->width = intval($width); + } /* }}} */