Thanks CHBMB! I did need to run the preview:generate-all first to generate the previews for the existing images. However it ran for a few minutes and then I get the PHP error above. When I try to rerun the command I get the same result. I have tried restarting the nextcloud docker too but it results in the same error.
Error PHP Allowed memory size of 134217728 bytes exhausted (tried to allocate 12288 bytes) at /config/www/nextcloud/lib/private/legacy/image.php#477 in a few seconds
Error PHP Allowed memory size of 134217728 bytes exhausted (tried to allocate 12288 bytes) at /config/www/nextcloud/lib/private/legacy/image.php#477 a minute ago
Error PHP Allowed memory size of 134217728 bytes exhausted (tried to allocate 12288 bytes) at /config/www/nextcloud/lib/private/legacy/image.php#477 a minute ago
Error PHP Allowed memory size of 134217728 bytes exhausted (tried to allocate 12288 bytes) at /config/www/nextcloud/lib/private/legacy/image.php#477 7 minutes ago
Error PHP Allowed memory size of 134217728 bytes exhausted (tried to allocate 12288 bytes) at /config/www/nextcloud/lib/private/legacy/image.php#477 7 minutes ago
Error PHP Allowed memory size of 134217728 bytes exhausted (tried to allocate 12288 bytes) at /config/www/nextcloud/lib/private/legacy/image.php#477 14 minutes ago
Any idea why this is happening?