Excellent software and practical tutorials
NextcloudofThumbnailNextcloud's thumbnail optimization is very helpful for the access speed of Nextcloud's network disk. Let's take a look at how to install the preview generator! The preview generator has been tested on Nextcloud with the highest version 18.x released in 2020. Thumbnail generation is normal.
Tested file formats:
avi, doc, bmp, gif, jpg, md, mkv, mp3, mp4, odp, ods, odt, pdf, png, psd, svg, tif, ttf, txt, xls.
Install the Preview Builder app:
Install the preview generator in the Nextcloud app store and enable it after installation.
Or install from the Nextcloud app store:apps.nextcloud.com/apps/previewgenerator
Install LibreOffice Software
After installing the preview generator, you need to install the LibreOffice software on the server.
dnf -y install libreoffice-headless
dnf -y install libreoffice-writer
dnf -y install libreoffice-impress
dnf -y install libreoffice-calc
dnf -y install libreoffice-draw
dnf -y install libreoffice-langpack-zh-Hans
For detailed installation instructions of the latest version of LibreOffice, please refer to:CentOS 8 manual and dnf/yum installation of LibreOffice
Install ffmpeg, ImageMagick and Ghostscript
If you don't have the source of additional software installed, please install it first. Reference:How to Install FFmpeg on CentOS 8 / RHEL 8
dnf -y install ffmpeg imagemagick ghostscript
Modify Nextcloud's configuration file
After the above software is installed, you need to modify the Nextcloud config configuration file
vi /var/www/nextcloud/config/config.php
Paste the following content in config.php, where preview_libreoffice_path is the path where you installed libreoffice.
'preview_libreoffice_path' => '/usr/bin/libreoffice',
'enable_previews' => true,
'enabledPreviewProviders' =>
array (
0 => 'OC\Preview\TXT',
1 => 'OC\Preview\MarkDown',
2 => 'OC\Preview\OpenDocument',
3 => 'OC\Preview\PDF',
4 => 'OC\Preview\MSOffice2003',
5 => 'OC\Preview\MSOfficeDoc',
6 => 'OC\Preview\PDF',
7 => 'OC\Preview\Image',
8 => 'OC\Preview\Photoshop',
9 => 'OC\Preview\TIFF',
10 => 'OC\Preview\SVG',
11 => 'OC\Preview\Font',
12 => 'OC\Preview\MP3',
13 => 'OC\Preview\Movie',
14 => 'OC\Preview\MKV',
15 => 'OC\Preview\MP4',
16 => 'OC\Preview\AVI',
),
Save the config configuration file, restart the web server and PHP, or reboot directly.
createAutomatically generateThumbnail scheduled tasks
The last step is to generate thumbnails of all files and create a scheduled task.
sudo -u www php /var/www/nextcloud/occ preview:generate-all -vvv
crontab -u www -e
*/10 * * * * php /var/www/nextcloud/occ preview:pre-generate -vvv