HEIC/MOV previews

after adding the enable_previews and the providers, i went ahead and checked the log and found this:

Memcache \OC\Memcache\APCu not available for local cache
Memcache \OC\Memcache\APCu not available for distributed cache

Regards!

i got those errors removed by executing the following command:

echo ‘apc.enable_cli=1’ >> /etc/php/7.2/mods-available/apcu.ini
sudo service apache2 restart

then i ran sudo -u www-data php -f /var/www/htm/nextcloud/occ preview:generate-all --path=path-to-heicphotos

no errors on the log so far, but still no previews of the HEIC photos on the gallery app via web.

1 Like

Nextcloud relies on the imagick program command line program to convert images. If this program supports the HEIC format, Nextcloud should also be able to create the preview files.

See how it could be enabled:

Afaik, the following command can be used to check if the HEIC format is supported:

# php -r 'phpinfo();' | grep HEIC

The imagick support can be checked by executing this command:

 convert --version
4 Likes

OMG, after following the link provided, i was able to get my Nextcloud to preview the HEIC files on the web browser!

Kudos to you sir for the amazing advise/help. :smiley:

Thanks a lot!!

2 Likes

Hi,

did not want to open another thread, hope its ok to post here.

I have nc 17.0.1 and imagemagic 7.x. I can see HEIC preview and when I right click and select details, I can see a picture on the right hand corner.

However, if I click on the name of the picture, or the small thumbnail of the HEIC itself, the browser attempts to download the image. If I do the same to an jpg or png file, the image opens nice and big and I can view it in browser. How can I have the same behaviour for the HEIC file as I get with a jpg or png file?

Thanks.

That happened to me as well and it got fixed after restarting the browser

I have setup the HEIC compatibility a few month ago already and have used various browsers on many different devices and platforms, and the behavior is the same.

Any other ideas?

I just replicated your issue.

This is what I did, if you open the “files/fotos and try to open an picture, web browser will download the picture.

If you go to the gallery and click on the picture, the browser will show it on it.

Displaying HEIC pictures seem not to be fully supported yet. See https://github.com/nextcloud/viewer/issues/4

@Dridhas
I have exactly the same behaviour. When I work with the pictures, its easier to do with the file view and not the gallery. Problem is, I like to preview the picture before I delete or download it. With JPEG and other older formats, its no problem, just HEIC.

@j-ed
Thank you. I hope this will be implemented soon. It seems like the preview is working in gallery view, it just needs to be “ported” to the file view. But I don’t know the inner workings of nextcloud …

Thanks to all!

you probably need to get the Preview Generator app and have a cron job run every so often to get the previews generated.

Also, this article will get imagick to work with HEIC/HEIF photos.

https://medium.com/@eplt/5-minutes-to-install-imagemagick-with-heic-support-on-ubuntu-18-04-digitalocean-fe2d09dcef1

now gallery and files show a small preview.

1 Like

Hello,

php -r ‘phpinfo();’ | grep HEIC

convert --version

both two commands are supported, but the heic preview image is not displayed on the browser.
I can’t find out why.

It seems you haven’t read all provided information in detail. Follow the description provided in posting “HEIC/MOV previews” to get the imagemagick support enabled on the console. Once it is supported by the console programs you can enable the php module and the used command will return the expected information :wink:


Thank you very much for your answer.
These two commands have returned the expected information. But the preview still doesn’t appear . And I can’t open the link you gave me because of the region .headache!

Nextcloud’s config.php I changed it, too.as follows:
‘enable_previews’ => true,
‘preview_Movie_path’ => ‘/usr/bin/ffmpeg’,
‘enabledPreviewProviders’ =>
array (
0 => ‘OC\Preview\TXT’,
1 => ‘OC\Preview\MarkDown’,
2 => ‘OC\Preview\OpenDocument’,
3 => ‘OC\Preview\PDF’,
4 => ‘OC\Preview\MSOffice2003’,
5 => ‘OC\Preview\MSOfficeDoc’,
6 => ‘OC\Preview\PDF’,
7 => ‘OC\Preview\Image’,
8 => ‘OC\Preview\Photoshop’,
9 => ‘OC\Preview\HEIC’,
10 => ‘OC\Preview\SVG’,
11 => ‘OC\Preview\Font’,
12 => ‘OC\Preview\MP3’,
13 => ‘OC\Preview\Movie’,
14 => ‘OC\Preview\MKV’,
15 => ‘OC\Preview\MP4’,
16 => ‘OC\Preview\AVI’,
),
But it still doesn’t work , I don 't know what else to set

Is there a better way to provide heic/mov preview?

I have Ubuntu 20.04/nginx and the description under HEIC/MOV previews exaggerated to me. Isn’t there already something better?

Thanks you, I followed your steps more or less and I think this way is simplier.
Worked on Nextcloud v22

Installing dependencies:
sudo apt-get install imagemagick-common php-imagick ffmpeg libmagickcore-dev libde265 libheif

Checking if worked, search for extensions
php -r 'phpinfo();' | grep HEIC

Add setup in config.php
sudo nano /var/www/nextcloud/config/config.php

  'enable_previews' => true,
  'preview_max_x' => 1000,
  'preview_max_y' => 1000,
  'enabledPreviewProviders' => [
    'OC\Preview\TXT',
    'OC\Preview\MarkDown',
    'OC\Preview\PDF',
    'OC\Preview\MSOfficeDoc',
    'OC\Preview\JPEG',
    'OC\Preview\PNG',
    'OC\Preview\GIF',
    'OC\Preview\BMP',
    'OC\Preview\XBitmap',
    'OC\Preview\MP3',
    'OC\Preview\HEIC',
    'OC\Preview\Movie',
    'OC\Preview\MKV',
    'OC\Preview\MP4',
    'OC\Preview\AVI',
  ],

Restart webserver:

sudo systemctl restart apache2
3 Likes

Is there a way to do the same in a docker container? I’ve been trying to SSH into the apache portion of nextcloud aio, but it does not seem to have neither bash nor sh shells available.

Hi,

After following step-by-step instructions from here:

https://eplt.medium.com/5-minutes-to-install-imagemagick-with-heic-support-on-ubuntu-18-04-digitalocean-fe2d09dcef1

and from here:

I did not succeed to have .heic preview in browser.

I still have exactly the same behavior as described by manojknaikade i.e. I get an empty output for php -r ‘phpinfo();’ | grep HEIC.

Also, checking a phpinfo.php via browser, I don’t find HEIC support in the installed imagick module description (capture attached).

One thing to be signaled also: when launching the autogen.sh and configure in the sequence below, I get “No such file” error.

cd /usr/src/libheif/
./autogen.sh
./configure

but the libheif folder does contain some files:

root@cloud:/usr/src/imagick-3.5.1# cd /usr/src/libheif/
root@cloud:/usr/src/libheif# dir
CMakeLists.txt README.md examples gnome logos tests
CMakePresets.json appveyor.yml extra go post.js third-party
COPYING build-emscripten.sh fuzzing libheif pre.js
CPPLINT.cfg cmake gdk-pixbuf libheif.pc.in scripts

root@cloud:/usr/src/libheif# cd /usr/src/libheif/
root@cloud:/usr/src/libheif# ./autogen.sh
-bash: ./autogen.sh: No such file or directory
root@cloud:/usr/src/libheif# ./configure
-bash: ./configure: No such file or directory
root@cloud:/usr/src/libheif#

Could someone guide me from here?

My configuration is:
PHP Version 7.4.3-4 ubuntu2.18
Nextcloud Hub 3 (25.0.7)

I have preview-generator working with other types of images.

Thank you,

For me all the server-side basic stuff was working (like it was quite some time, maybe months or even few years ago). It was disabled by default in a NC release and could be re-enabled in the config.php. HEIC is working again, MOV (HEVC) is not but that’s likely due to a browser problem as it is working in the iOS app.