Preview generation via Imaginary doesnt work

The Basics

  • Nextcloud Server version (e.g., 29.x.x):
    • 34.0.1.2
  • Operating system and version (e.g., Ubuntu 24.04):
    • Debian Trixie
  • Web server and version (e.g, Apache 2.4.25):
    • nginx 1.26.3
  • PHP version (e.g, 8.3):
    • 8.4
  • Is this the first time you’ve seen this error? (Yes / No):
    • no
  • When did this problem seem to first start?
    • now
  • Installation method (e.g. AlO, NCP, Bare Metal/Archive, etc.)
    • Bare Metal
  • Are you using CloudfIare, mod_security, or similar? (Yes / No)
    • No

Summary of the issue you are facing:

I’m currently trying to have Imaginary generate the previews. To do this, I started a Docker container via docker run -d --name=imaginary -p 9000:9000 --restart=always ghcr.io/nextcloud-releases/aio-imaginary:latest

The container is running; I can see it when I run docker ps -a.

Now I’m checking whether the requests are reaching the container using docker logs -f imaginary and starting the preview generation with occ preview:generate-all -vvv. I can see that previews are being created, but there’s no log for the container—it remains empty.

Using curl -O "http://127.0.0.1:9000/crop?width=500&height=400&url=https://raw.githubusercontent.com/h2non/imaginary/master/testdata/large.jpg" works fine and i can see the result with docker logs -f imaginary

Log entries

complete empty

Nextcloud

Nothing in Nextcloud logs

Configuration

Nextcloud

The output of occ config:list system or similar is best, but, if not possible, the contents of your config.php file from /path/to/nextcloud is fine (make sure to remove any identifiable information!):

{
    "system": {
        "instanceid": "***REMOVED SENSITIVE VALUE***",
        "passwordsalt": "***REMOVED SENSITIVE VALUE***",
        "secret": "***REMOVED SENSITIVE VALUE***",
        "serverid": 1,
        "trusted_domains": [
            "***REMOVED SENSITIVE VALUE***"
        ],
        "datadirectory": "***REMOVED SENSITIVE VALUE***",
        "version": "34.0.1.2",
        "overwrite.cli.url": "***REMOVED SENSITIVE VALUE***",
        "dbtype": "mysql",
        "dbname": "***REMOVED SENSITIVE VALUE***",
        "dbuser": "***REMOVED SENSITIVE VALUE***",
        "dbpassword": "***REMOVED SENSITIVE VALUE***",
        "dbhost": "***REMOVED SENSITIVE VALUE***",
        "dbtableprefix": "oc_",
        "mysql.utf8mb4": true,
        "installed": true,
        "default_language": "de",
        "default_timezone": "Europe\/Berlin",
        "memories.db.triggers.fcu": true,
        "memories.exiftool": "\/var\/www\/nextcloud\/apps\/memories\/bin-ext\/exiftool-aarch64-glibc",
        "memories.vod.path": "\/var\/www\/nextcloud\/apps\/memories\/bin-ext\/go-vod-aarch64",
        "memories.vod.ffmpeg": "\/usr\/bin\/ffmpeg",
        "memories.vod.ffprobe": "\/usr\/bin\/ffprobe",
        "memories.vod.disable": true,
        "memories.video_default_quality": "-2",
        "memories.vod.use_transpose": true,
        "memories.vod.use_gop_size": true,
        "memories.gis_type": 1,
        "memories.index.mode": "3",
        "memories.index.path.blacklist": "\\\/@(Recycle|eaDir|calibre)\\\/",
        "memories.index.path": "\/Photos",
        "enable_previews": true,
        "enabledPreviewProviders": [
            "OC\\Preview\\Imaginary",
            "OC\\Preview\\MP3",
            "OC\\Preview\\Movie"
        ],
        "preview_imaginary_url": "http://127.0.0.1:9000",
        "preview_max_x": 2048,
        "preview_max_y": 2048,
        "preview_max_scale_factor": 1,
        "preview_max_filesize_image": 100,
        "jpeg_quality": 60,
        "default_phone_region": "DE",
        "integrity.check.disabled": false,
        "knowledgebaseenabled": false,
        "mail_smtpmode": "smtp",
        "mail_sendmailmode": "pipe",
        "mail_from_address": "***REMOVED SENSITIVE VALUE***",
        "mail_domain": "***REMOVED SENSITIVE VALUE***",
        "mail_smtphost": "***REMOVED SENSITIVE VALUE***",
        "mail_smtpauth": true,
        "mail_smtpport": "465",
        "debug": false,
        "overwriteprotocol": "https",
        "activity_expire_days": 14,
        "auth.bruteforce.protection.enabled": true,
        "ratelimit.protection.enabled": true,
        "trashbin_retention_obligation": "auto, 7",
        "logfile": "\/var\/log\/nextcloud\/nextcloud.log",
        "logtimezone": "Europe\/Berlin",
        "loglevel": 2,
        "log_rotate_size": 0,
        "remember_login_cookie_lifetime": 1296000,
        "session_lifetime": 86400,
        "session_keepalive": true,
        "auto_logout": true,
        "profile.enabled": false,
        "memcache.local": "\\OC\\Memcache\\APCu",
        "memcache.locking": "\\OC\\Memcache\\Redis",
        "redis": {
            "host": "***REMOVED SENSITIVE VALUE***",
            "port": 0,
            "timeout": 1,
            "password": "***REMOVED SENSITIVE VALUE***"
        },
        "twofactor_enforced": "true",
        "twofactor_enforced_groups": [],
        "twofactor_enforced_excluded_groups": [
            "test"
        ],
        "defaultapp": "files",
        "forbidden_filename_characters": [
            "<",
            ">",
            ":",
            "\"",
            "|",
            "?",
            "*",
            "\\",
            "\/"
        ],
        "forbidden_filename_extensions": [
            " ",
            ".",
            ".filepart",
            ".part"
        ],
        "filesystem_check_changes": 0,
        "maintenance_window_start": 1,
        "maintenance": false,
        "trusted_proxies": "***REMOVED SENSITIVE VALUE***",
        "theme": "",
        "cron_log": true,
        "forbidden_filenames": [
            ".htaccess",
            "Thumbs.db",
            "thumbs.db"
        ],
        "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"
        ],
        "music.lastfm_api_key": "***REMOVED SENSITIVE VALUE***",
        "mail_smtpsecure": "ssl",
        "mail_smtpname": "***REMOVED SENSITIVE VALUE***",
        "mail_smtppassword": "***REMOVED SENSITIVE VALUE***"
    }
}

Apps

The output of occ app:list (if possible).

Enabled:
  - appstore: 1.0.0
  - bruteforcesettings: 7.0.0
  - calendar: 6.5.0
  - cloud_federation_api: 1.18.0
  - contacts: 8.7.3
  - dav: 1.39.0
  - federatedfilesharing: 1.24.0
  - files: 2.6.0
  - files_external: 1.26.0
  - files_lock: 34.0.0
  - files_pdfviewer: 7.0.0-dev.0
  - files_sharing: 1.26.0
  - files_trashbin: 1.24.0
  - logreader: 7.0.0
  - lookup_server_connector: 1.22.0
  - memories: 8.1.0
  - music: 3.1.0
  - notifications: 7.0.0-dev.1
  - notify_push: 1.3.3
  - oauth2: 1.22.0
  - office: 1.0.0
  - password_policy: 6.0.0-dev.0
  - photos: 7.0.0
  - previewgenerator: 5.14.0
  - profile: 1.3.0
  - provisioning_api: 1.24.0
  - richdocuments: 11.0.0
  - richdocumentscode_arm64: 26.4.104
  - serverinfo: 6.0.0
  - settings: 1.17.0
  - suspicious_login: 12.0.0-dev.0
  - systemtags: 1.24.0
  - text: 8.0.0
  - theming: 2.9.0
  - twofactor_backupcodes: 1.23.0
  - twofactor_totp: 16.0.0
  - updatenotification: 1.24.0
  - user_migration: 10.4.0
  - viewer: 7.0.0-dev.0
  - workflowengine: 2.16.0
Disabled:
  - activity: 7.0.0 (installed 4.0.0)
  - admin_audit: 1.24.0 (installed 1.21.0)
  - app_api: 34.0.0 (installed 5.0.2)
  - circles: 34.0.0 (installed 32.0.0)
  - comments: 1.24.0 (installed 1.21.0)
  - contactsinteraction: 1.15.0 (installed 1.12.0)
  - dashboard: 7.14.0 (installed 7.11.0)
  - dav_push: 1.0.2 (installed 1.0.2)
  - encryption: 2.22.0 (installed 2.19.0)
  - federation: 1.24.0 (installed 1.21.0)
  - files_downloadlimit: 5.2.0-dev.0 (installed 4.0.0)
  - files_reminders: 1.7.0 (installed 1.4.0)
  - files_versions: 1.27.0 (installed 1.24.0)
  - firstrunwizard: 7.0.0-dev.0 (installed 4.0.0)
  - mail: 5.10.7 (installed 5.10.7)
  - nextcloud_announcements: 6.0.0 (installed 3.0.0)
  - privacy: 6.0.0-dev.1 (installed 3.0.0)
  - recommendations: 7.0.0 (installed 4.0.0)
  - related_resources: 5.0.0-dev.0 (installed 4.0.0-dev.0)
  - sharebymail: 1.24.0 (installed 1.21.0)
  - support: 6.0.0 (installed 3.0.0)
  - survey_client: 6.0.0-dev.0 (installed 5.0.0-dev.0)
  - testing: 1.23.0
  - theming_customcss: 1.20.0 (installed 1.20.0)
  - twofactor_nextcloud_notification: 8.0.0
  - user_ldap: 1.25.0
  - user_status: 1.14.0 (installed 1.11.0)
  - weather_status: 1.14.0 (installed 1.13.0)
  - webhook_listeners: 1.6.0 (installed 1.5.0)

@nofferel

now you’re not using snap that’s clear, but see How to generate image previews in Nextcloud with Imaginary with Docker - :bookmark_tabs: How to - Nextcloud community, maybe that helps you to get imaginary working as expected.

you’re using AIO, why don’t you run imaginary within AIO see
nextcloud/all-in-one: :package: The official Nextcloud installation method. Provides easy deployment and maintenance with most features included in this one Nextcloud instance.

I don’t use an AIO for Nextcloud itself. Just the Docker container for imaginary. This is explicitly recommended in the documentation you linked to. The same problem occurs with Package aio-imaginary · GitHub.

Otherwise, the rest is set up as described in your post. The missing file types are intentionally configured that way. According to the documentation, the only important thing is that OC\\Preview\\Imaginary is enabled. And that’s the case here. That’s exactly why I don’t understand it either.

great so we’re dáccord…

i’m scratching my dumb brain about this… i’m a snap man, not a docker dude, so i’d try putting the host IP in there instead of localhost → just a hunch, i’m not even sure about that, but localhost would imply the docker container and that port is exposed on the physical host? don’t put my head on a chopping block, its just an idea :cat_with_wry_smile:

Yep. It’s the same host. I have also tried the real local ip, ‘localhost’, the hostname. Nothing works. There is just no call to imaginary. On the other hand using curl and call the url work fine: curl -O "http://127.0.0.1:9000/crop?width=500&height=400&url=https://raw.githubusercontent.com/h2non/imaginary/master/testdata/large.jpg"

Port 9000 or 9001? I see references to both in what you posted.

Ahh sorry for that I have tried 2 different docker container. 1 on port 9000 and the other one on 9001. Both with the same result.

Using tcpdump, I’ve now determined that the integration with imaginary is indeed working, but docker logs -f dockerid/name no longer shows incoming requests. Only the container’s startup is logged, not the requests itself. This is very confusing, especially since this is the standard way to check whether the integration is working.

I’ve now run tcpdump -i any -nn port 9000 and can see the requests appearing. The thumbnails are then also displayed in Nextcloud. I hope logging will be re-enabled in a future version or at least made configurable. I’m not sure if I can enable it myself somewhere. Maybe that’s possible.

From my perspective, this resolves the actual problem. But perhaps the documentation should mention that you can use tcpdump -i any -nn port 9000 to test the connection.