Can't preview HEIC images

Nextcloud version: 27.1.1
Operating system and version: Fedora 38
Nginx version: nginx/1.24.0
PHP version: 8.2.10

The issue you are facing:
Title pretty much says it all. I can’t preview HEIC images. And even when I try to download the files themselves, I just get an internal server error (which I’m less worried about for the time being).
I have the following packages installed:

  • imagemagick
  • php-pecl-imagemagick
  • libde265
  • libheif

Steps to replicate it:

  1. Click on heic file in files app (which opens preview).

The output of the Nextcloud log in Admin > Logging:

{"reqId":"GGJcoDh4fT0nKdH1xaAT","level":3,"time":"2023-10-03T03:37:07+00:00","remoteAddr":"10.0.0.6","user":"matthew","app":"core","method":"GET","url":"/core/preview?fileId=49497&x=2560&y=1440&a=true&etag=1c330f31a1d0f93254a6ea7f0464eaee","message":"File: /matthew/files/Talk/20230729_193327.heic Imagick says:","userAgent":"Mozilla/5.0 (Windows NT 10.0; rv:109.0) Gecko/20100101 Firefox/118.0","version":"27.1.1.0","exception":{"Exception":"ImagickException","Message":"Unsupported feature: Unsupported codec (4.3000) `/var/www/nextcloud/data/matthew/files/Talk/20230729_193327.heic' @ error/heic.c/IsHEIFSuccess/138","Code":425,"Trace":[{"file":"/var/www/nextcloud/lib/private/Preview/HEIC.php","line":116,"function":"readImage","class":"Imagick","type":"->"},{"file":"/var/www/nextcloud/lib/private/Preview/HEIC.php","line":76,"function":"getResizedPreview","class":"OC\\Preview\\HEIC","type":"->"},{"file":"/var/www/nextcloud/lib/private/Preview/GeneratorHelper.php","line":64,"function":"getThumbnail","class":"OC\\Preview\\HEIC","type":"->"},{"file":"/var/www/nextcloud/lib/private/Preview/Generator.php","line":397,"function":"getThumbnail","class":"OC\\Preview\\GeneratorHelper","type":"->"},{"file":"/var/www/nextcloud/lib/private/Preview/Generator.php","line":373,"function":"generateProviderPreview","class":"OC\\Preview\\Generator","type":"->"},{"file":"/var/www/nextcloud/lib/private/Preview/Generator.php","line":166,"function":"getMaxPreview","class":"OC\\Preview\\Generator","type":"->"},{"file":"/var/www/nextcloud/lib/private/Preview/Generator.php","line":116,"function":"generatePreviews","class":"OC\\Preview\\Generator","type":"->"},{"file":"/var/www/nextcloud/lib/private/PreviewManager.php","line":192,"function":"getPreview","class":"OC\\Preview\\Generator","type":"->"},{"file":"/var/www/nextcloud/core/Controller/PreviewController.php","line":144,"function":"getPreview","class":"OC\\PreviewManager","type":"->"},{"file":"/var/www/nextcloud/core/Controller/PreviewController.php","line":113,"function":"fetchPreview","class":"OC\\Core\\Controller\\PreviewController","type":"->"},{"file":"/var/www/nextcloud/lib/private/AppFramework/Http/Dispatcher.php","line":230,"function":"getPreviewByFileId","class":"OC\\Core\\Controller\\PreviewController","type":"->"},{"file":"/var/www/nextcloud/lib/private/AppFramework/Http/Dispatcher.php","line":137,"function":"executeController","class":"OC\\AppFramework\\Http\\Dispatcher","type":"->"},{"file":"/var/www/nextcloud/lib/private/AppFramework/App.php","line":183,"function":"dispatch","class":"OC\\AppFramework\\Http\\Dispatcher","type":"->"},{"file":"/var/www/nextcloud/lib/private/Route/Router.php","line":315,"function":"main","class":"OC\\AppFramework\\App","type":"::"},{"file":"/var/www/nextcloud/lib/base.php","line":1068,"function":"match","class":"OC\\Route\\Router","type":"->"},{"file":"/var/www/nextcloud/index.php","line":36,"function":"handleRequest","class":"OC","type":"::"}],"File":"/var/www/nextcloud/lib/private/Preview/HEIC.php","Line":116,"message":"File: /matthew/files/Talk/20230729_193327.heic Imagick says:","exception":[],"CustomMessage":"File: /matthew/files/Talk/20230729_193327.heic Imagick says:"},"id":"651b8c66c59b0"}

This is also always followed by another error (this is not the one that directly follows the previous error, as I’m adding this in an edit - also what’s interesting about this particular error is that it references a jpeg file…) about “WRONGPASS invalid username-password pair or user is disabled”:

<log deleted>

This second part seems to now affect all files, and this is something new to me. I’ve changed a few things today, but the big one is the apcu/redis stuff. It used to just be apcu, but I added redis to the settings today. The settings overview/self check doesn’t report any issues though.
Edit: And commenting out the redis stuff did make file downloads work again.

config.php:

<?php
$CONFIG = array (
  'instanceid' => '',
  'passwordsalt' => '',
  'secret' => '',
  'trusted_domains' => 
  array (
    0 => '',
    1 => '',
    2 => '',
  ),
  'datadirectory' => '/var/www/nextcloud/data',
  'dbtype' => 'mysql',
  'version' => '27.1.1.0',
  'overwrite.cli.url' => '',
  'dbname' => 'nextcloud',
  'dbhost' => 'localhost',
  'dbport' => '',
  'dbtableprefix' => 'oc_',
  'mysql.utf8mb4' => true,
  'dbuser' => 'nextcloud',
  'dbpassword' => '',
  'installed' => true,
  'maintenance' => false,
  'theme' => '',
  'logfile' => '/var/log/nextcloud/nextcloud.log',
  'loglevel' => 0,
  'default_phone_region' => 'US',
  'filelocking.enabled' => true,
  //'memcache.local' => '\\OC\\Memcache\\APCu',
  //'memcache.locking' => '\\OC\\Memcache\\Redis',
  'mail_smtpmode' => 'sendmail',
  'mail_sendmailmode' => 'smtp',
  'mail_from_address' => 'system',
  'mail_domain' => '',
  'redis' => 
  array (
    'host' => '/var/run/redis/redis.sock',
    'port' => 0,
    'user' => 'nextcloud',
    'password' => '',
    'timeout' => 0.0,
  ),
        'enabled_previews' => true,
        'enabledPreviewProviders' => array (
                0 => 'OC\\Preview\\BMP',
                1 => 'OC\\Preview\\GIF',
                2 => 'OC\\Preview\\JPEG',
                3 => 'OC\\Preview\\MarkDown',
                4 => 'OC\\Preview\\MP3',
                5 => 'OC\\Preview\\PNG',
                6 => 'OC\\Preview\\TXT',
                7 => 'OC\\Preview\\XBitmap',
                8 => 'OC\\Preview\\OpenDocument',
                9 => 'OC\\Preview\\Krita',
                10 => 'OC\\Preview\\WebP',
                11 => 'OC\\Preview\\HEIC',
        ),
);

I should probably add that I have in fact searched for this online and seen other people with similar issues, but so far none of the suggestions I’ve tried have worked (most have been install X package or make Y change to config.php).

On Debian, I remember to have installed following packages :

imagemagick-common php-imagick ffmpeg libmagickcore-dev libde265 libheif

Have you all the corresponding ones installed on your Fedora ?

I believe so.
I have:

  • ImageMagick (imagemagick-common?)
  • php-pecl-imagick (php-imagick)
  • ffmpeg
  • ImageMagick-devel (libmagickcore-dev?)
  • libde265
  • libheif

Solved meanwhile?

Edit: [Solved] Image Previews only working for HEIC photos - #8 by Lucas_E did the trick for me.