Vote for Nextcloud in the CloudComputing-Insider Award 2026
Is Nextcloud your top choice as cloud content management solution? Vote for us in the CloudComputing-Insider Award 2026 and show your support!
Read More
Nextcloud Hub 26 Spring is here. Check the relase blog post and explore all new features!
Read moreGuest post by @morph027
If you’re using the fantastic Nextcloud and like to feel comfortable browsing all your auto-uploaded photos like once upon a time you did in some proprietary Picasa or so, you can benefit from the Preview Generator, which will take care of pre-rendering the thumbnails. This means faster, smoother scrolling and previewing your images, both in your browser and on mobile devices!
As it states you must add some cron magic to get it working and the Nextcloud folks asked for a tutorial, here’s how to do it with cron or (my preference) with systemd timers.
www-data, nginx, httpd, … – depends on your distribution). You can find out by looking at the owner of the nextcloud files using ls -laphp executable (which php)occ file, depends in which folder your Nextcloud has been installed (e.g. /var/www/nextcloud/occ)Add or create a new cronjob for the Nextcloud user:
crontab -e -u www-data
Using your favourite editor, add something like this, which will run the job at 04:00:
0 4 * * * /usr/bin/php -f /var/www/nextcloud/occ preview:pre-generate
Systemd also has the possibility to run specific tasks at specific times or events. called Timers. You need to create 2 unit files:
/etc/systemd/system/nextcloud-preview-generator.service[Unit]
Description=Nextcloud Preview Generator
[Service]
Type=oneshot
User=www-data
ExecStart=/usr/bin/php -f /var/www/nextcloud/occ preview:pre-generate
[Install]
WantedBy=basic.target
/etc/systemd/system/nextcloud-preview-generator.timer[Unit]
Description=Run Nextcloud Preview Generator daily at 04:00
[Timer]
OnCalendar=*-*-* 4:00:00
Persistent=true
[Install]
WantedBy=timers.target
systemctl daemon-reloadsystemctl enable nextcloud-preview-generator.timersystemctl start nextcloud-preview-generator.timer