I have spent weeks researching this issue and no solution anywhere has resolved it. Hopefully this will serve as a main support thread for all users experiencing this issue.
For the life of me I can’t get HEIC or DNG images to display a preview even though I have all installed requirements in my server.
Notice HEIC is available:
php -r 'phpinfo();' | grep HEIC
ImageMagick supported formats => 3FR, 3G2, 3GP, AAI, AI, APNG, ART, ARW, AVI, AVIF, AVS, BGR, BGRA, BGRO, BIE, BMP, BMP2, BMP3, BRF, CAL, CALS, CANVAS, CAPTION, CIN, CIP, CLIP, CMYK, CMYKA, CR2, CR3, CRW, CUR, CUT, DATA, DCM, DCR, DCX, DDS, DFONT, DJVU, DNG, DOT, DPX, DXT1, DXT5, EPDF, EPI, EPS, EPS2, EPS3, EPSF, EPSI, EPT, EPT2, EPT3, ERF, EXR, FAX, FILE, FITS, FRACTAL, FTP, FTS, G3, G4, GIF, GIF87, GRADIENT, GRAY, GRAYA, GROUP4, GV, H, HALD, HDR, HEIC, HISTOGRAM, HRZ, HTM, HTML, HTTP, HTTPS, ICB, ICO, ICON, IIQ, INFO, INLINE, IPL, ISOBRL, ISOBRL6, J2C, J2K, JBG, JBIG, JNG, JNX, JP2, JPC, JPE, JPEG, JPG, JPM, JPS, JPT, JSON, K25, KDC, LABEL, M2V, M4V, MAC, MAGICK, MAP, MASK, MAT, MATTE, MEF, MIFF, MKV, MNG, MONO, MOV, MP4, MPC, MPG, MRW, MSL, MSVG, MTV, MVG, NEF, NRW, NULL, ORF, OTB, OTF, PAL, PALM, PAM, PANGO, PATTERN, PBM, PCD, PCDS, PCL, PCT, PCX, PDB, PDF, PDFA, PEF, PES, PFA, PFB, PFM, PGM, PGX, PICON, PICT, PIX, PJPEG, PLASMA, PNG, PNG00, PNG24, PNG32, PNG48, PNG64, PNG8, PNM, POCKETMOD, PPM, PREVIEW, PS, PS2, PS3, PSB, PSD, PTIF, PWP, RADIAL-GRADIENT, RAF, RAS, RAW, RGB, RGBA, RGBO, RGF, RLA, RLE, RMF, RW2, SCR, SCT, SFW, SGI, SHTML, SIX, SIXEL, SPARSE-COLOR, SR2, SRF, STEGANO, SUN, SVG, SVGZ, TEXT, TGA, THUMBNAIL, TIFF, TIFF64, TILE, TIM, TTC, TTF, TXT, UBRL, UBRL6, UIL, UYVY, VDA, VICAR, VID, VIDEO, VIFF, VIPS, VST, WBMP, WEBM, WEBP, WMF, WMV, WMZ, WPG, X, X3F, XBM, XC, XCF, XPM, XPS, XV, XWD, YCbCr, YCbCrA, YUV
convert --version
Version: ImageMagick 6.9.11-60 Q16 x86_64 2021-01-25 https://imagemagick.org
Copyright: (C) 1999-2021 ImageMagick Studio LLC
License: https://imagemagick.org/script/license.php
Features: Cipher DPC Modules OpenMP(4.5) 
Delegates (built-in): bzlib djvu fftw fontconfig freetype heic jbig jng jp2 jpeg lcms lqr ltdl lzma openexr pangocairo png tiff webp wmf x xml zlib
The Basics
- Nextcloud Server version (e.g., 29.x.x):
Nextcloud Hub 10 (31.0.3)
 - Operating system and version (e.g., Ubuntu 24.04):
Ubuntu 22.04
 - Web server and version (e.g, Apache 2.4.25):
Server version: Apache/2.4.52 (Ubuntu)
 - Reverse proxy and version _(e.g. nginx 1.27.2)
NONE
 - PHP version (e.g, 8.3):
Version: 8.2.28
 - Is this the first time you’ve seen this error? (Yes / No):
No
 - When did this problem seem to first start?
Always existed but just started using HEIC/DNG format
 - Installation method (e.g. AlO, NCP, Bare Metal/Archive, etc.)
VM (ESXi)
 - Are you using CloudfIare, mod_security, or similar? (Yes / No)
No
 
Summary of the issue you are facing:
[…]
Steps to replicate it (hint: details matter!):
- Take photo using Apple RAW (HEIC)
 - Wait until Nextcloud uploads it to the server using the mobile app.
 - Upon viewing the thumbnails, photo has no preview and won’t display. Download is the only option.
 
Log entries
{
  "reqId": "y5bfpEVQsC5St50KXQ9i",
  "level": 3,
  "time": "2025-04-14T18:31:30+00:00",
  "remoteAddr": "192.168.143.44",
  "user": "REDACTED_USER",
  "app": "core",
  "method": "GET",
  "url": "/nextcloud/index.php/core/preview?fileId=1375213&x=1024&y=1024&a=1&mode=cover&forceIcon=0&mimeFallback=0",
  "message": "File: /REDACTED_USER/files/NFS FreeNAS/REDACTED_DIR/Photos/2025/04/25-04-13 13-33-51 9920.heic Imagick says:",
  "userAgent": "Mozilla/5.0 (iOS) Nextcloud-iOS/6.6.0",
  "version": "31.0.3.2",
  "exception": {
    "Exception": "ImagickException",
    "Message": "Failed to read the file",
    "Code": 1,
    "Trace": [
      {
        "file": "/var/www/html/nextcloud/lib/private/Preview/HEIC.php",
        "line": 100,
        "function": "pingImage",
        "class": "Imagick",
        "type": "->"
      },
      {
        "file": "/var/www/html/nextcloud/lib/private/Preview/HEIC.php",
        "line": 57,
        "function": "getResizedPreview",
        "class": "OC\\Preview\\HEIC",
        "type": "->"
      },
      {
        "file": "/var/www/html/nextcloud/lib/private/Preview/GeneratorHelper.php",
        "line": 44,
        "function": "getThumbnail",
        "class": "OC\\Preview\\HEIC",
        "type": "->"
      },
      {
        "file": "/var/www/html/nextcloud/lib/private/Preview/Generator.php",
        "line": 338,
        "function": "getThumbnail",
        "class": "OC\\Preview\\GeneratorHelper",
        "type": "->"
      },
      {
        "file": "/var/www/html/nextcloud/lib/private/Preview/Generator.php",
        "line": 314,
        "function": "generateProviderPreview",
        "class": "OC\\Preview\\Generator",
        "type": "->"
      },
      {
        "file": "/var/www/html/nextcloud/lib/private/Preview/Generator.php",
        "line": 120,
        "function": "getMaxPreview",
        "class": "OC\\Preview\\Generator",
        "type": "->"
      },
      {
        "file": "/var/www/html/nextcloud/lib/private/Preview/Generator.php",
        "line": 87,
        "function": "generatePreviews",
        "class": "OC\\Preview\\Generator",
        "type": "->"
      },
      {
        "file": "/var/www/html/nextcloud/lib/private/PreviewManager.php",
        "line": 167,
        "function": "getPreview",
        "class": "OC\\Preview\\Generator",
        "type": "->"
      },
      {
        "file": "/var/www/html/nextcloud/core/Controller/PreviewController.php",
        "line": 168,
        "function": "getPreview",
        "class": "OC\\PreviewManager",
        "type": "->"
      },
      {
        "file": "/var/www/html/nextcloud/core/Controller/PreviewController.php",
        "line": 127,
        "function": "fetchPreview",
        "class": "OC\\Core\\Controller\\PreviewController",
        "type": "->"
      },
      {
        "file": "/var/www/html/nextcloud/lib/private/AppFramework/Http/Dispatcher.php",
        "line": 200,
        "function": "getPreviewByFileId",
        "class": "OC\\Core\\Controller\\PreviewController",
        "type": "->"
      },
      {
        "file": "/var/www/html/nextcloud/lib/private/AppFramework/Http/Dispatcher.php",
        "line": 114,
        "function": "executeController",
        "class": "OC\\AppFramework\\Http\\Dispatcher",
        "type": "->"
      },
      {
        "file": "/var/www/html/nextcloud/lib/private/AppFramework/App.php",
        "line": 161,
        "function": "dispatch",
        "class": "OC\\AppFramework\\Http\\Dispatcher",
        "type": "->"
      },
      {
        "file": "/var/www/html/nextcloud/lib/private/Route/Router.php",
        "line": 307,
        "function": "main",
        "class": "OC\\AppFramework\\App",
        "type": "::"
      },
      {
        "file": "/var/www/html/nextcloud/lib/base.php",
        "line": 1025,
        "function": "match",
        "class": "OC\\Route\\Router",
        "type": "->"
      },
      {
        "file": "/var/www/html/nextcloud/index.php",
        "line": 24,
        "function": "handleRequest",
        "class": "OC",
        "type": "::"
      }
    ],
    "File": "/var/www/html/nextcloud/lib/private/Preview/HEIC.php",
    "Line": 100,
    "message": "File: /REDACTED_USER/files/NFS FreeNAS/REDACTED_DIR/Photos/2025/04/25-04-13 13-33-51 9920.heic Imagick says:",
    "exception": [],
    "CustomMessage": "File: /REDACTED_USER/files/NFS FreeNAS/REDACTED_DIR/Photos/2025/04/25-04-13 13-33-51 9920.heic Imagick says:"
  },
  "id": "67fd90cf0e262"
}
Web server / Reverse Proxy
The output of your Apache/nginx/system log in /var/log/____:
None
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!):
<?php
$CONFIG = array (
  'instanceid' => 'REDACTED',
  'passwordsalt' => 'REDACTED',
  'secret' => 'REDACTED',
  'trusted_domains' => 
  array (
    0 => '192.168.143.5',
  ),
  'datadirectory' => '/var/www/html/nextcloud/data',
  'dbtype' => 'mysql',
  'version' => '31.0.3.2',
  'overwrite.cli.url' => 'https://192.168.143.5/nextcloud',
  'dbname' => 'nextcloud',
  'dbhost' => 'localhost',
  'dbport' => '',
  'dbtableprefix' => 'oc_',
  'mysql.utf8mb4' => true,
  'dbuser' => 'REDACTED',
  'dbpassword' => 'REDACTED',
  'installed' => true,
  'htaccess.RewriteBase' => '/nextcloud',
  'trashbin_retention_obligation' => '10, 15',
  'filelocking.enabled' => 'true',
  'default_phone_region' => 'US',
  'memcache.local' => '\\OC\\Memcache\\APCu',
  'memcache.locking' => '\\OC\\Memcache\\Redis',
  'redis' => 
  array (
    'host' => '127.0.0.1',
    'port' => '6379',
    'timeout' => '0.0',
  ),
  'mail_smtpmode' => 'smtp',
  'mail_smtpsecure' => 'ssl',
  'mail_sendmailmode' => 'smtp',
  'mail_from_address' => 'REDACTED',
  'mail_domain' => 'gmail.com',
  'mail_smtpauth' => 1,
  'mail_smtpauthtype' => 'LOGIN',
  'mail_smtphost' => 'smtp.gmail.com',
  'mail_smtpport' => '465',
  'mail_smtpname' => 'REDACTED',
  'mail_smtppassword' => 'REDACTED',
  'maintenance' => false,
  'theme' => '',
  'loglevel' => 2,
  'app_install_overwrite' => 
  array (
    0 => 'analytics',
    1 => 'bbb',
  ),
  'memories.exiftool' => '/var/www/html/nextcloud/apps/memories/bin-ext/exiftool-amd64-glibc',
  'memories.vod.path' => '/var/www/html/nextcloud/apps/memories/bin-ext/go-vod-amd64',
  'maintenance_window_start' => 1,
);