Previews jumping up as popcorn

You may increase gallery and thumbnail performance significantly by enabling the previewgenerator app. Download and enable both, as well the gallery and as the previewgenerator app. Then run a preview-generation task, wait until the generation ends, edit crontab to perform periodic thumbnail generations for new created data and finally enjoy your previews as “jumping popcorn”! Let’s start:

Disable the current gallery-app as Administrator in your Nextcloud App-Panel and stop nginx:

sudo -s
service nginx stop

Change to Nextclous app directory

cd /var/www/nextcloud/apps

and delete the old gallery app:

rm -R gallery

Download both apps from git, extract the new binaries, rename the directories and remove the download packages:

wget https://github.com/rullzer/previewgenerator/archive/master.zip
unzip master.zip
mv previewgenerator-master previewgenerator
rm master.zip
wget https://github.com/nextcloud/gallery/archive/master.zip
unzip master.zip
mv gallery-master gallery
rm master.zip

Start nginx again:

service nginx start

and enable both apps, the Gallery and the Preview Generator App, in the Nextcloud App-Panel:

The generation of previews will take a long time. It is recommend to run the following command using screen.

apt install screen

Start a dedicated screen session

screen -S PreviewGeneration

and start the preview generation:

cd /var/www/nextcloud
sudo -u www-data /var/www/nextcloud php occ preview-generate-all

The duration depends of the amount of data … be patient and stay tuned! At least we edit crontab for the webuser to generate new thumbnails for new created data automatically e.g. every hour:

sudo crontab -u www-data -e

Add the following line:

@hourly php -f /var/www/nextcloud/occ preview:pre-generate >> /home/<ubuntuuser>/preview.log

Check crontab using:

crontab -u www-data -l

The output should look similar to mine:

*/15 * * * * php -f /var/www/nextcloud/cron.php > /dev/null 2>&1
@hourly php -f /var/www/nextcloud/occ preview:pre-generate >> /home/<ubuntuuser>/preview.log

Enjoy your Nextcloud!