No preview generator available for file of typeimage/jpeg

The Basics

  • Nextcloud Server version (e.g., 29.x.x):
    • 28.0.12
  • Operating system and version (e.g., Ubuntu 24.04):
    • x86_64 GNU/Linux - Service Provider is STRATO on a shared enviroment
  • Web server and version (e.g, Apache 2.4.25):
    • Apache/2.4.62 (Unix)
  • PHP version (e.g, 8.3):
    • 8.3.12
  • 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:

Generelly there are no previews generate on my Nextcloud Installation. I startet on version 28 so up until now I have not run a major upgrade. I tried to tweak the config.php to allow for preview generation but I am still unable to so manually and it is not done automatically either.

Memories-App is telling me, that it can access PHP-Imagick [ImageMagick 6.9.13-7 Q16 x86_64 18310 https://legacy.imagemagick.org].

On occ-level things are getting weird:

occ preview:generate /USER/files/picture.jpg

No preview generator available for file of typeimage/jpeg

occ preview:generate /USER/files/favicon.png

No preview generator available for file of typeimage/png

occ config:system:get enable_previews

false

Trying to change that via occ config:system:set enable_previews --value=“true” --type=boolean seems to work.

System config value enable_previews set to boolean true

But checking again via occ config:system:get enable_previews results in

false

Providers are all activated:

occ config:system:get 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\Image
OC\Preview\HEIC
OC\Preview\TIFF

Baffled I am. I thought I check my config again only to find a great discrepancy between my NEXTCLOUDDIR/config/config.php

<?php
$CONFIG = array (
  'instanceid' => '***REMOVED SENSITIVE VALUE***',
  'passwordsalt' => '***REMOVED SENSITIVE VALUE***',
  'secret' => '***REMOVED SENSITIVE VALUE***',
  'trusted_domains' => 
  array (
    0 => '***REMOVED SENSITIVE VALUE***',
  ),
  'datadirectory' => '***REMOVED SENSITIVE VALUE***',
  'dbtype' => 'mysql',
  'version' => '28.0.12.2',
  'overwrite.cli.url' => '***REMOVED SENSITIVE VALUE***',
  'dbname' => '***REMOVED SENSITIVE VALUE***',
  'dbhost' => '***REMOVED SENSITIVE VALUE***',
  'dbport' => '',
  'dbtableprefix' => 'oc_',
  'mysql.utf8mb4' => true,
  'dbuser' => '***REMOVED SENSITIVE VALUE***',
  'dbpassword' => '***REMOVED SENSITIVE VALUE***',
  'installed' => true,
  'maintenance_window_start' => 1,
  'app_install_overwrite' => 
  array (
    0 => 'occweb',
    1 => 'files_markdown',
  ),
  'mail_smtpmode' => 'smtp',
  'mail_sendmailmode' => 'smtp',
  'mail_from_address' => '***REMOVED SENSITIVE VALUE***',
  'mail_domain' => '***REMOVED SENSITIVE VALUE***',
  'mail_smtpauth' => '***REMOVED SENSITIVE VALUE***',
  'mail_smtphost' => '***REMOVED SENSITIVE VALUE***',
  'mail_smtpport' => '465',
  'mail_smtpname' => '***REMOVED SENSITIVE VALUE***',
  'mail_smtppassword' => '***REMOVED SENSITIVE VALUE***',
  'mail_smtpsecure' => 'ssl',
  'defaultapp' => '',
  'default_language' => 'de',
  'default_locale' => 'de_DE',
  'default_phone_region' => 'DE',
  'debug' => false,
  'loglevel' => 2,
  'logtimezone' => 'Europe/Berlin',
  'maintenance' => false,
  'theme' => '',
  'enable_previews' => true,
  'preview_concurrency_all' => 8,
  'preview_concurrency_new' => 4,
  'preview_max_x' => 4096,
  'preview_max_y' => 4096,
  'preview_max_filesize_image' => 50,
  'preview_max_memory' => 256,
  'enabledPreviewProviders' => 
  array (
    0 => 'OC\\Preview\\BMP',
    1 => 'OC\\Preview\\GIF',
    2 => 'OC\\Preview\\JPEG',
    3 => 'OC\\Preview\\Krita',
    4 => 'OC\\Preview\\MarkDown',
    5 => 'OC\\Preview\\MP3',
    6 => 'OC\\Preview\\OpenDocument',
    7 => 'OC\\Preview\\PNG',
    8 => 'OC\\Preview\\TXT',
    9 => 'OC\\Preview\\XBitmap',
    10 => 'OC\\Preview\\Image',
    11 => 'OC\\Preview\\HEIC',
    12 => 'OC\\Preview\\TIFF',
  ),
  'memories.db.triggers.fcu' => true,
  'memories.exiftool_no_local' => true,
  'memories.vod.path' => '***REMOVED SENSITIVE VALUE***',
  'updater.secret' => '***REMOVED SENSITIVE VALUE***',
);

and the output of occ config:list system:

{
    "system": {
        "instanceid": "***REMOVED SENSITIVE VALUE***",
        "passwordsalt": "***REMOVED SENSITIVE VALUE***",
        "secret": "***REMOVED SENSITIVE VALUE***",
        "trusted_domains": [
            "***REMOVED SENSITIVE VALUE***",
        ],
        "datadirectory": "***REMOVED SENSITIVE VALUE***",
        "dbtype": "mysql",
        "version": "28.0.12.2",
        "overwrite.cli.url": "***REMOVED SENSITIVE VALUE***",
        "dbname": "***REMOVED SENSITIVE VALUE***",
        "dbhost": "***REMOVED SENSITIVE VALUE***",
        "dbport": "",
        "dbtableprefix": "oc_",
        "mysql.utf8mb4": true,
        "dbuser": "***REMOVED SENSITIVE VALUE***",
        "dbpassword": "***REMOVED SENSITIVE VALUE***",
        "installed": true,
        "maintenance_window_start": 1,
        "app_install_overwrite": [
            "occweb",
            "files_markdown"
        ],
        "mail_smtpmode": "smtp",
        "mail_sendmailmode": "smtp",
        "mail_from_address": "***REMOVED SENSITIVE VALUE***",
        "mail_domain": "***REMOVED SENSITIVE VALUE***",
        "mail_smtpauth": 1,
        "mail_smtphost": "***REMOVED SENSITIVE VALUE***",
        "mail_smtpport": "465",
        "mail_smtpname": "***REMOVED SENSITIVE VALUE***",
        "mail_smtppassword": "***REMOVED SENSITIVE VALUE***",
        "mail_smtpsecure": "ssl",
        "defaultapp": "",
        "default_language": "de",
        "default_locale": "de_DE",
        "default_phone_region": "DE",
        "debug": false,
        "loglevel": 2,
        "logtimezone": "Europe\/Berlin",
        "maintenance": false,
        "theme": "",
        "enable_previews": false,
        "preview_concurrency_all": 8,
        "preview_concurrency_new": 4,
        "preview_max_x": 4096,
        "preview_max_y": 4096,
        "preview_max_filesize_image": 50,
        "preview_max_memory": 256,
        "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\\Image",
            "OC\\Preview\\HEIC",
            "OC\\Preview\\TIFF"
        ],
        "memories.db.triggers.fcu": true,
        "memories.exiftool_no_local": true,
        "memories.vod.path": "***REMOVED SENSITIVE VALUE***",
        "updater.secret": "***REMOVED SENSITIVE VALUE***"
    }
}

Any ideas how to fix this mess? I am happy to provide logs or files if they are missing here!

Thanks in advance,

roxi

Configuration

Apps

occ app:list

Enabled:
  - activity: 2.20.0
  - bruteforcesettings: 2.8.0
  - calendar: 4.7.16
  - circles: 28.0.0
  - cloud_federation_api: 1.11.0
  - comments: 1.18.0
  - contacts: 5.5.3
  - contactsinteraction: 1.9.0
  - dav: 1.29.2
  - federatedfilesharing: 1.18.0
  - federation: 1.18.0
  - files: 2.0.0
  - files_pdfviewer: 2.9.0
  - files_reminders: 1.1.0
  - files_sharing: 1.20.0
  - files_trashbin: 1.18.0
  - files_versions: 1.21.0
  - firstrunwizard: 2.17.0
  - logreader: 2.13.0
  - lookup_server_connector: 1.16.0
  - memories: 7.4.1
  - nextcloud_announcements: 1.17.0
  - notes: 4.11.0
  - notifications: 2.16.0
  - oauth2: 1.16.4
  - occweb: 0.2.0
  - password_policy: 1.18.0
  - photos: 2.4.0
  - previewgenerator: 5.7.0
  - privacy: 1.12.0
  - provisioning_api: 1.18.0
  - recommendations: 2.0.0
  - related_resources: 1.3.0
  - serverinfo: 1.18.0
  - settings: 1.10.1
  - sharebymail: 1.18.0
  - support: 1.11.1
  - survey_client: 1.16.0
  - systemtags: 1.18.0
  - text: 3.9.2
  - theming: 2.3.0
  - twofactor_backupcodes: 1.17.0
  - updatenotification: 1.18.0
  - user_status: 1.8.1
  - viewer: 2.2.0
  - weather_status: 1.8.0
  - workflowengine: 2.10.0
Disabled:
  - admin_audit: 1.18.0
  - dashboard: 7.8.0 (installed 7.8.0)
  - encryption: 2.16.0
  - files_external: 1.20.0
  - files_markdown: 2.4.1 (installed 2.4.1)
  - suspicious_login: 6.0.0
  - twofactor_totp: 10.0.0-beta.2
  - user_ldap: 1.19.0

The Preview generation of jpg and png images is not done by (php-)imagick but php-gd instead. (more information here)

What is the output of:

[ "$(dpkg -l | awk '/php8.3-gd/{print $2}')" == "php8.3-gd" ] && echo "php-gd is installed" || echo "php-gd is NOT installed"

If it is not installed, run

sudo apt-get install php8.3-gd

and try again if jpg and png previews are generated then.

h.t.h.


Much and good luck,
ernolf

Hey ernolf,

thank you for your help!

As stated above I am running this on a shared host at STRATO. Due to security on this shared host I am unable to install my own system tools. Their documentation states php-gd is enabled. You can find a short printout of the GD-section from phpinfo();

GD Support 	enabled
GD Version 	bundled (2.1.0 compatible)
FreeType Support 	enabled
FreeType Linkage 	with freetype
FreeType Version 	2.13.1
GIF Read Support 	enabled
GIF Create Support 	enabled
JPEG Support 	enabled
libJPEG Version 	9 compatible
PNG Support 	enabled
libPNG Version 	1.6.43
WBMP Support 	enabled
XBM Support 	enabled
WebP Support 	enabled
BMP Support 	enabled
TGA Read Support 	enabled

It seems to me php-gd is working fine.

Do you have multiple files in your config/ folder by chance? (like backup config files for example).

I ask because if they have the *.config.php suffix they will get merged with your main config.php to generate Nextcloud’s running config. That might explain why your occ config:list system output shows previews disabled still.

Hey jtr,

thank you so much for this hint. I indeed had a two other files in that folder. One was called add.config.php and hidden in there was the magic enable_previews = false that was responsible for the odd occ behaviors. Thank you so much for pointing this out! It is helping me a ton!

Best regards,

roxi

1 Like

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