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:

mv previewgenerator-master previewgenerator
chown -R www-data:www-data /var/www

Start nginx again:

service nginx start

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

or via Nextclouds command line tool:

cd /var/www/nextcloud
sudo -u www-data php occ app:enable gallery
sudo -u www-data php occ app:enable preview-generator

The generation of previews will take a long time, that’s why we recommend screen for running the following command. If not already installed just run

apt install screen

first. Then create a dedicated screen session

screen -S PreviewGeneration

to start the preview generation:

cd /var/www/nextcloud
sudo -u www-data 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 e.g. the following line:

@daily 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
@daily php -f /var/www/nextcloud/occ preview:pre-generate >> /home/<ubuntuuser>/preview.log

Enjoy your Nextcloud!