No preview generator available for any file type

The Basics

  • Nextcloud Server version (e.g., 29.x.x):
    • Nextcloud Hub 30.0.2
  • Operating system and version (e.g., Ubuntu 24.04):
    • Fedora 41
  • Web server and version (e.g, Apache 2.4.25):
    • Apache/2.4.62
  • PHP version (e.g, 8.3):
    • PHP 8.3.13
  • Is this the first time you’ve seen this error? (Yes / No):
    • Yes
  • When did this problem seem to first start?
    • Always been like this since first install 29
  • Installation method (e.g. AIO, NCP, Bare Metal/Archive, etc.)
    • Bare Metal
  • Are you using Cloudflare, mod_security, or similar? (Yes / No)
    • No

Summary of the issue you are facing:

Whenever I try to generate a preview (occ preview:generate <file>.jpg) I get an error in console saying No preview generator available for file of typeimage/jpeg.

Steps to replicate it (hint: details matter!):

  1. occ preview:generate <file>.jpg
  2. No preview generator available for file of typeimage/jpeg

Log entries

Nextcloud

Cannot find log in either data-dir nor the option under Administration Settings.
But the logs in journalctl (journalctl -eft Nextcloud) are empty when executing the command.

Configuration

Nextcloud

occ config:list system
{
    "system": {
        "log_type": "syslog",
        "datadirectory": "***REMOVED SENSITIVE VALUE***",
        "updatechecker": false,
        "check_for_working_htaccess": false,
        "asset-pipeline.enabled": false,
        "assetdirectory": "\/var\/lib\/nextcloud",
        "preview_libreoffice_path": "\/usr\/bin\/libreoffice",
        "apps_paths": [
            {
                "path": "\/usr\/share\/nextcloud\/apps",
                "url": "\/apps",
                "writable": false
            },
            {
                "path": "\/var\/lib\/nextcloud\/apps",
                "url": "\/apps-appstore",
                "writable": true
            }
        ],
        "passwordsalt": "***REMOVED SENSITIVE VALUE***",
        "secret": "***REMOVED SENSITIVE VALUE***",
        "trusted_domains": [
            "localhost",
            "<redacted FQDN>",
            "<redacted IP>",
            "127.0.0.1"
        ],
        "overwrite.cli.url": "https:\/\/<redacted FQDN>",
        "htaccess.RewriteBase": "\/",
        "memcache.local": "\\OC\\Memcache\\APCu",
        "dbtype": "mysql",
        "version": "30.0.2.2",
        "dbname": "***REMOVED SENSITIVE VALUE***",
        "dbhost": "***REMOVED SENSITIVE VALUE***",
        "dbport": "",
        "dbtableprefix": "oc_",
        "mysql.utf8mb4": true,
        "dbuser": "***REMOVED SENSITIVE VALUE***",
        "dbpassword": "***REMOVED SENSITIVE VALUE***",
        "installed": true,
        "instanceid": "***REMOVED SENSITIVE VALUE***",
        "default_phone_region": "<redacted region>",
        "defaultapp": "files",
        "maintenance_window_start": "3",
        "ldapProviderFactory": "OCA\\User_LDAP\\LDAPProviderFactory",
        "maintenance": false,
        "skeletondirectory": "",
        "templatedirectory": "",
        "enable_previews": true,
        "preview_max_x": "2048",
        "preview_max_y": "2048",
        "preview_max_scale_factor": 2,
        "preview_max_filesize_image": 200,
        "preview_max_memory": 1024,
        "enabledPreviewProviders": [
            "\\OC\\Preview\\BMP",
            "\\OC\\Preview\\GIF",
            "\\OC\\Preview\\JPEG",
            "\\OC\\Preview\\PNG"
        ],
        "mail_smtpmode": "smtp",
        "mail_sendmailmode": "smtp",
        "theme": "",
        "loglevel": 2,
        "jpeg_quality": "60"
    }
}

Apps

occ apps:list
Enabled:
  - activity: 3.0.0
  - app_api: 4.0.0
  - bruteforcesettings: 3.0.0
  - circles: 30.0.0
  - cloud_federation_api: 1.13.0
  - comments: 1.20.1
  - contactsinteraction: 1.11.0
  - dashboard: 7.10.0
  - dav: 1.31.1
  - federatedfilesharing: 1.20.0
  - federation: 1.20.0
  - files: 2.2.0
  - files_downloadlimit: 3.0.0
  - files_pdfviewer: 3.0.0
  - files_reminders: 1.3.0
  - files_sharing: 1.22.0
  - files_trashbin: 1.20.1
  - files_versions: 1.23.0
  - firstrunwizard: 3.0.0
  - lookup_server_connector: 1.18.0
  - nextcloud_announcements: 2.0.0
  - notifications: 3.0.0
  - oauth2: 1.18.1
  - onlyoffice: 9.5.0
  - password_policy: 2.0.0
  - photos: 3.0.2
  - previewgenerator: 5.7.0
  - privacy: 2.0.0
  - provisioning_api: 1.20.0
  - recommendations: 3.0.0
  - related_resources: 1.5.0
  - serverinfo: 2.0.0
  - settings: 1.13.0
  - sharebymail: 1.20.0
  - support: 2.0.0
  - survey_client: 2.0.0
  - systemtags: 1.20.0
  - text: 4.1.0
  - theming: 2.5.0
  - twofactor_backupcodes: 1.19.0
  - updatenotification: 1.20.0
  - user_ldap: 1.21.0
  - user_status: 1.10.0
  - viewer: 3.0.0
  - weather_status: 1.10.0
  - webhook_listeners: 1.1.0-dev
  - workflowengine: 2.12.0
Disabled:
  - admin_audit: 1.20.0
  - documentserver_community: 0.1.20 (installed 0.1.20)
  - drawio: 3.0.3 (installed 3.0.3)
  - encryption: 2.18.0
  - epubviewer: 1.6.4 (installed 1.6.2)
  - files_external: 1.22.0
  - fileslibreofficeedit: 2.0.1 (installed 2.0.1)
  - logreader: 3.0.0 (installed 2.13.0)
  - photos.bak: 2.4.0
  - suspicious_login: 8.0.0
  - twofactor_nextcloud_notification: 4.0.0
  - twofactor_totp: 12.0.0-dev
occ config:list previewgenerator
{
    "apps": {
        "previewgenerator": {
            "enabled": "yes",
            "heightSizes": "256",
            "installed_version": "5.7.0",
            "squareSizes": "32 256",
            "squareUncroppedSizes": "256 4096",
            "types": "filesystem",
            "widthSizes": "256 384"
        }
    }
}
occ config:list preview
{
    "apps": {
        "preview": {
            "jpeg_quality": "60"
        }
    }
}

PHP

php -m
[PHP Modules]
apcu
bcmath
bz2
calendar
Core
ctype
curl
date
dom
exif
fileinfo
filter
ftp
gd
gettext
gmp
hash
iconv
igbinary
imagick
intl
json
ldap
libsmbclient
libxml
mbstring
memcached
msgpack
mysqli
mysqlnd
openssl
pcntl
pcre
PDO
pdo_mysql
pdo_sqlite
Phar
posix
random
readline
redis
Reflection
session
shmop
SimpleXML
smbclient
sockets
sodium
SPL
sqlite3
standard
sysvmsg
sysvsem
sysvshm
tokenizer
xml
xmlreader
xmlwriter
xsl
Zend OPcache
zip
zlib

[Zend Modules]
Zend OPcache
php -i | grep -x gd -A 24
gd

GD Support => enabled
GD headers Version => 2.3.3
GD library Version => 2.3.3
FreeType Support => enabled
FreeType Linkage => with freetype
GIF Read Support => enabled
GIF Create Support => enabled
JPEG Support => enabled
PNG Support => enabled
WBMP Support => enabled
XPM Support => enabled
XBM Support => enabled
WebP Support => enabled
BMP Support => enabled
AVIF Support => enabled
TGA Read Support => enabled

Directive => Local Value => Master Value
gd.jpeg_ignore_warning => On => On

gettext

GetText Support => enabled

Details about the image tested

mediainfo -f 20241125_154042.jpg
General
Count                                    : 349
Count of stream of this kind             : 1
Kind of stream                           : General
Kind of stream                           : General
Stream identifier                        : 0
Count of image streams                   : 1
Image_Format_List                        : JPEG
Image_Format_WithHint_List               : JPEG
Codecs Image                             : JPEG
Complete name                            : 20241125_154042.jpg
Folder name                              : Downloads
File name extension                      : 20241125_154042.jpg
File name                                : 20241125_154042
File extension                           : jpg
Format                                   : JPEG
Format                                   : JPEG
Format/Extensions usually used           : h3d jpeg jpg jpe jps mpo
Commercial name                          : JPEG
Internet media type                      : image/jpeg
File size                                : 7106737
File size                                : 6.78 MiB
File size                                : 7 MiB
File size                                : 6.8 MiB
File size                                : 6.78 MiB
File size                                : 6.778 MiB
Stream size                              : 0
Stream size                              : 0.00 Byte (0%)
Stream size                              :  Byte0
Stream size                              : 0.0 Byte
Stream size                              : 0.00 Byte
Stream size                              : 0.000 Byte
Stream size                              : 0.00 Byte (0%)
Proportion of this stream                : 0.00000
File last modification date              : 2024-11-26 10:31:28 UTC
File last modification date (local)      : <redacted>

Image
Count                                    : 166
Count of stream of this kind             : 1
Kind of stream                           : Image
Kind of stream                           : Image
Stream identifier                        : 0
Format                                   : JPEG
Format                                   : JPEG
Commercial name                          : JPEG
Internet media type                      : image/jpeg
Width                                    : 8160
Width                                    : 8 160 pixels
Height                                   : 6120
Height                                   : 6 120 pixels
Color space                              : YUV
Chroma subsampling                       : 4:2:0
Bit depth                                : 8
Bit depth                                : 8 bits
Compression mode                         : Lossy
Compression mode                         : Lossy
Stream size                              : 7106737
Stream size                              : 6.78 MiB (100%)
Stream size                              : 7 MiB
Stream size                              : 6.8 MiB
Stream size                              : 6.78 MiB
Stream size                              : 6.778 MiB
Stream size                              : 6.78 MiB (100%)
Proportion of this stream                : 1.00000

What I’ve Tried

I have tried the following:

  1. Disable, remove, install previewgenerator-app
  2. Empty oc_filecache
  3. Various preview_ settings
  4. Removing preview-folder in data-path, which is re-created when running a occ preview command
  5. Running preview:pre-generate and preview:generate-all more times than I can count by now
  6. Restarting httpd and php-fpm many times
  7. Running occ files:scan mutliple times
  8. Running occ files:scan-app-data multiple times
  9. SELinux both Enforced and Permissive

There is only one (1) config-file present in /etc/nextcloud (my config location), which is config.php.File a094c5b2-8c5d-1036-9667-c78a89139def/files/Photos/bobtest/radioaktiv_2_3.png not found
root@nextcloud-1:/usr/share/nextcloud# sudo -u webServer1apache php /usr/share/nextcloud/occ preview:generate a094c5b2-8c5d-1036-9667-c78a89139def/files/bobtest/radioaktiv_2_3.png -vvvv
No preview generator available for file of typeimage/png
root@nextcloud-1:/usr/share/nextcloud# sudo -u webServer1apache php /usr/share/nextcloud/occ preview:generate a094c5b2-8c5d-1036-9667-c78a89139def/files/bobtest/noun-spanner-6553900.png -vvvv
No preview generator available for file of typeimage/png
root@nextcloud-1:/usr/share/nextcloud# sudo -u webServer1apache php /usr/share/nextcloud/occ preview:generate a094c5b2-8c5d-1036-9667-c78a89139def/files/bobtest/noun-spanner-6553900.BMP -vvvv
No preview generator available for file of typeimage/bmp

I have honestly no idea what I am missing here and any help is appreciated. Oh yeah, there are no thumbnails/previews showing in neither browser nor app either.

Br

UPDATE: I just tested with .png and .bmp but none of those work either and fails with the same error as .jpg/jpeg.

After spending WAY too much time looking at more or less correct things I finally found my answer.

In my config-file I had listed the providers in a wrong way. I don’t know why it was listed like this but changing it to how it looks like in the config.sample.php available at github made all the difference.

Previously I had

'enabledPreviewProviders' => 
  array (
    0 => 'OC\Preview\BMP',
    1 => 'OC\Preview\GIF',
    2 => 'OC\Preview\JPEG',
    3 => 'OC\Preview\PNG',
  ),

and then I changed it to

  'enabledPreviewProviders' => [
	'OC\Preview\BMP',
	'OC\Preview\GIF,
	'OC\Preview\JPEG',
	'OC\Preview\PNG'
  ],

and now all previews are actually generated when I execute occ preview:generate-all.

Hello,

I have the same problem on a bare metal server where I installed
Nextcloud Hub 30.0.2; my configuration :

Rocky Linux 9.5
Mariadb 30.0.2.2
Apache 2.4.62
PHP 8.3.14

Regarding the occ commands above I have similar results except for:

  • occ preview:generate which gives me: File not found

  • occ config:list preview which gives me:
    {
    “apps”: {
    “preview”:
    }
    }

Also the online editor doesn’t work, if I click on a text file it
is just downloaded to my computer.

Is there a way to solve ?
Thank you

Could you provide the full output of the occ config:list system-command? Also, what is the (kind of) full command you used for occ preview:generate?

Hi,

my commands :

  • sudo -u apache php /var/www/html/nextcloud/occ config:list system
    Output :
    {
    “system”: {
    “instanceid”: “REMOVED SENSITIVE VALUE”,
    “passwordsalt”: “REMOVED SENSITIVE VALUE”,
    “secret”: “REMOVED SENSITIVE VALUE”,
    “trusted_domains”: [
    “localhost”,
    “MY NETWORK1”,
    “MY NETWORK2”,
    “MY HOSTNAME”
    ],
    “datadirectory”: “REMOVED SENSITIVE VALUE”,
    “dbtype”: “mysql”,
    “version”: “30.0.2.2”,
    “overwrite.cli.url”: “https://MY HOSTNAME/nextcloud”,
    “htaccess.RewriteBase”: “/nextcloud”,
    “dbname”: “REMOVED SENSITIVE VALUE”,
    “dbhost”: “REMOVED SENSITIVE VALUE”,
    “dbport”: “”,
    “dbtableprefix”: “oc_”,
    “mysql.utf8mb4”: true,
    “dbuser”: “REMOVED SENSITIVE VALUE”,
    “dbpassword”: “REMOVED SENSITIVE VALUE”,
    “installed”: true,
    “loglevel”: 2,
    “memcache.local”: “\OC\Memcache\APCu”,
    “default_phone_region”: “IT”,
    “mail_from_address”: “REMOVED SENSITIVE VALUE”,
    “mail_smtpmode”: “smtp”,
    “mail_sendmailmode”: “smtp”,
    “mail_domain”: “REMOVED SENSITIVE VALUE”,
    “mail_smtphost”: “REMOVED SENSITIVE VALUE”,
    “mail_smtpport”: “25”,
    “forbidden_filename_basenames”: [
    “con”,
    “prn”,
    “aux”,
    “nul”,
    “com0”,
    “com1”,
    “com2”,
    “com3”,
    “com4”,
    “com5”,
    “com6”,
    “com7”,
    “com8”,
    “com9”,
    “com\u00b9”,
    “com\u00b2”,
    “com\u00b3”,
    “lpt0”,
    “lpt1”,
    “lpt2”,
    “lpt3”,
    “lpt4”,
    “lpt5”,
    “lpt6”,
    “lpt7”,
    “lpt8”,
    “lpt9”,
    “lpt\u00b9”,
    “lpt\u00b2”,
    “lpt\u00b3”
    ],
    “forbidden_filename_characters”: [
    “<”,
    “>”,
    “:”,
    “"”,
    “|”,
    “?”,
    “*”,
    “\”,
    “/”
    ],
    “forbidden_filename_extensions”: [
    " ",
    “.”,
    “.filepart”,
    “.part”
    ],
    “enabledPreviewProviders”: [
    “OC\Preview\BMP”,
    “OC\Preview\GIF”,
    “OC\Preview\JPEG”,
    “OC\Preview\Krita”,
    “OC\Preview\MarkDown”,
    “OC\Preview\MP3”,
    “OC\Preview\OpenDocument”,
    “OC\Preview\PNG”,
    “OC\Preview\TXT”,
    “OC\Preview\XBitmap”,
    “OC\Preview\ImaginaryPDF”
    ]
    }
    }

  • sudo -u apache php /var/www/html/nextcloud/occ preview:generate /tmp/Birdie.jpg -vvvv
    Output : File /tmp/Birdie.jpg not found

  • sudo -u apache php /var/www/html/nextcloud/occ preview:generate /hd_dati_cloud/admin/files/Photos/Birdie.jpg -vvvv
    Output : File /hd_dati_cloud/admin/files/Photos/Birdie.jpg not found

mediainfo /hd_dati_cloud/admin/files/Photos/Birdie.jpg
Output:
General
Complete name : /hd_dati_cloud/admin/files/Photos/Birdie.jpg
Format : JPEG
File size : 580 KiB

Image
Format : JPEG
Width : 1 600 pixels
Height : 1 067 pixels
Color space : YUV
Chroma subsampling : 4:2:2
Bit depth : 8 bits
Compression mode : Lossy
Stream size : 580 KiB (100%)

It looks like 2 things might be missing:

  • In the configuration file I have 'enable_previews' => true. Might be needed for you.
  • I see that you are testing the preview generator on the path /tmp which might not be working. The preview generator seems to work only on files in your datadirectory. Try to put a file in there and do occ preview:generate <datadirectory>/<file> (not full path) and se if that works.

Also, please when you post config and logs use the code-formatting-tags so that it becomes more readable. Single line stuff in between backticks (`) and blocks of text in between three backticks (```).

Hi, I tried both of your suggestions but it still doesn’t work

What was the output of sudo -u apache php /var/www/html/nextcloud/occ preview:generate admin/files/Photo/Birdie.jpg -vvv ?

The output is : preview generated
Should I see a new file somewhere ?

All generated previews should be present in sub-folders in the folder <datadirectory>/appdata_<instance id>/preview (which in your case I guess is somewhere in hd_dati_cloud/appdata_<instanceid>/preview.

In order to generate previews for all supported files, please see the preview:generate-all-command instructions on the previewgenerator-github.

I did the following :

  • sudo -u apache php /var/www/html/nextcloud/occ preview:generate-all -vvv
    Output : Encryption is enabled. Aborted.

  • sudo -u apache php /var/www/html/nextcloud/occ encryption:disable

  • sudo -u apache php /var/www/html/nextcloud/occ preview:generate-all -vvv
    This time I got :
    2024-12-03T15:16:12+00:00 Specifications: [{“width”:64,“height”:64,“crop”:true},{“width”:256,“height”:256,“crop”:true},{“width”:1024,“height”:1024,“crop”:true},{“width”:4096,“height”:4096,“crop”:true},{“width”:64,“height”:64,“crop”:false},{“width”:256,“height”:256,“crop”:false},{“width”:1024,“height”:1024,“crop”:false},{“width”:4096,“height”:4096,“crop”:false},{“width”:-1,“height”:64,“crop”:false},{“width”:-1,“height”:256,“crop”:false},{“width”:-1,“height”:1024,“crop”:false},{“width”:-1,“height”:4096,“crop”:false},{“width”:64,“height”:-1,“crop”:false},{“width”:256,“height”:-1,“crop”:false},{“width”:1024,“height”:-1,“crop”:false},{“width”:4096,“height”:-1,“crop”:false}]
    2024-12-03T15:16:12+00:00 Scanning folder /admin/files
    2024-12-03T15:16:12+00:00 Scanning folder /admin/files/Documents
    2024-12-03T15:16:12+00:00 Generating previews for /admin/files/Documents/Example.md

  • sudo -u apache php /var/www/html/nextcloud/occ encryption:enable

Anyway the preview on the web site of PDF files and edit of text file still
does not work. I’m thiking to install version 29.0.8.

This topic was automatically closed 8 days after the last reply. New replies are no longer allowed.