How to enable SVG for php-imagick

NC 21 complaints that SVG support is not available for php-imagick on my server. However, ImageMagick is installed as well as php-imagick and using identify -list format show SVG as a valid format. So I don’t know what I need to do to get this to work and the documentation doesn’t mention that topic at all.

4 Likes

SVG support is disabled by default due to security concerns as described here. It also explains how you can enable additional formats:

https://docs.nextcloud.com/server/17/admin_manual/configuration_files/previews_configuration.html?highlight=svg#previews-configuration

See also:

1 Like

Thanks for the links but that’s not related to my issue. The issue is new to NC 21 and it complaints about missing SVG support in php-imagick, not in the NC configuration.

I got SVG support to work on imagemagick by installing it manually with lots of extra options when compiling it from source.

But the PHP extension php-imagick is a separate thing which is not influenced by that. So it still lacks SVG support.

1 Like

Hello Jurge,

also on my side I install NC 21 and back warning on support SVG, follow your topic to solve.
Thanks

M.

1 Like

apt-get install libmagickcore-6.q16-6-extra <-- this will add the needed library.

29 Likes

@swindhab that’s already installed at my host, so there must be something else missing.

on my side I fix problem, thanks

14 Likes

I just set up a new instance with NC 21 and all I had to do was installing these two components:
apt install php-imagick imagemagick

After this, the warning in the admin UI was gone…

22 Likes

I’m using the docker image so I guess that they should apt install those libraries from now on in their base images.

6 Likes

For me the same. I use a docker installation and cannot install it all the time. That should be integrated into the image of nextcloud

1 Like

The same go’s for me. They should include the package in the docker image.

2 Likes

Hello, I had the same problem. And I solved it with these steps:

if you are using docker then:
1 . find out the docker container ID–> docker ps
2 isuue command → docker exec CONTAINER ID /bin/bash -c ‘apt update && apt install -y libmagickcore-6.q16-6-extra’

I works for me. But after giving docker-compose down and docker-compose up -d, The problem is there again. I read this is Version 21 problem. and have not found a perment solution yet. However, SVG warning is not critical.

I hope this helps

6 Likes

My problem here: libmagickcore-6.q16-6-extra is already the newest version (8:6.9.10.23+dfsg-2.1ubuntu11.2).,
php-imagick is already the newest version (3.4.4+php8.0+3.4.4-1+ubuntu18.04.1+deb.sury.org+1).
and imagemagick is already the newest version (8:6.9.10.23+dfsg-2.1ubuntu11.2).
All installed on one machine, no Docker

1 Like

You can create a new docker image based on the official Nextcloud image to add extra features.

FROM nextcloud:21-fpm

RUN apt-get update && apt-get install -y smbclient libsmbclient-dev libmagickwand-dev && rm -rf /var/lib/apt/lists/*

RUN pecl install inotify && docker-php-ext-enable inotify
RUN pecl install smbclient && docker-php-ext-enable smbclient
1 Like

When doing the same as ‘DecaTec’ has done, i recognize some php8.0 installations. I’m feared now. I remember having seen similar on my nextcloud predecessor instance when doing some regular updates and the the server became unusable. I don’t know if it does not boot at all but in any case i can’t ssh anymore as well as connect NC-Instance. It was Raspberry Pi 3B with 32bit OS, NC20. Recent instance (new from scratch) is NC21 on RPI 4B 64bit OS.

I’m feared to reboot now :open_mouth:

Does your server behave as expected?

Suggestions welcome, thx

I received prompts that the latests versions were already installed on my Ubuntu 20.04 server.

I had to manually uninstall the imagemagick and php-imagick packages:
sudo apt remove imagemagick
sudo apt remove php-imagick

Then install them again using:
sudo apt install php-imagick imagemagick

All checks passed after that.

11 Likes

Thanks!!! Remove with purge then install works for me (NC21, Ubuntu 20.04.2, PHP 7.4.9).

True but in the mean time you can docker exec into the nextcloud app container (if you annoyed with the warning like me), like in my case:

docker exec -it --user root nextcloud_app_1 apt update
docker exec -it --user root nextcloud_app_1 apt install imagemagick

3 Likes

@jurgenhaas I’m having the same issue, could you detail your solution? What options did you use to enable SVG. Did you compile and manually install imagemagick or php-imagick? or both?

@christiancloud I’m not having a solution, unfortunately. When I posted this issue here, I tried everything possible. Installing, updating, reinstalling all sorts of components. With no luck.

But what’s even more strange: eventually the warning from NC 21 disappared. I really have no idea what “solved” the problem - I just know it wasn’t be, at least not intentional.